Users and groups Flashcards
Add user in Linux?
“useradd” is the command
Can we modify user?
Yes, “usermod” is the command
Default values for users
/etc/login/defs
/etc/skel
/etc/default/useradd
What is the easiest way to access super user privileges?
su (substitute user) is the command
login as other user: su -
login as root: su -
Add password for user
passwd is the command
When do we need super user privileges?
System wide changes
Changes that affect other user
Configure services
View and set password policies (expiry date, etc..)
chage is the command
chage -l lists user password policy
note: policies include expiry period, etc.
How to create a group on Linux?
groupadd is the command
Modify and add users to groups on Linux?
groupmod to modify
gpasswd to add user
we can also add users to a group on useradd/usermod commands
View groups and users?
List users: /etc/passwd file
List user passwords: /etc/shadow file
List groups: /etc/group file
We can also use getent command - getnet passwd , getent group
We can use groups command as well to list user in a group - groups
What if I just want to perform a single command with supper user privileges?
We can use “sudo” command
Who is allowed to use “sudo” command?
Groups authorized in /etc/sudoers file
Groups like “sudo”, etc..
We can also authorize certain groups to execute certain commands on certain machines
How to edit sudoers file?
Best to use “visudo” command
Note: we need super user privileges
How to change password lenght and complexity policies in Linux?
Modify /etc/security/pwquality.conf