User Management
etc/group
Rename group test to test3
groupmod test -n test3
Change gid of a group test to 2000
groupmod test -g 2000
Make two groups New,test equally the same
groupmod New -og 2000
etc/passwd
Structure of the file
<user>:x:<uid>:<gid>:<description>:<home dir>:<shell>
Add user
useradd <user>
-m make user folder too
-s specify the shell
-g specify the group if any otherwise, primary group is <user>
-G add user to any groups group1,group2,group3 ...
-d specify user directory
-c comment on a user properties, qoute if space any
Modify user
usermod <user>
-l change to new user2
-d change home directory
-L Lock the user
-U Unlock the user
-aG append to user groups, not replace the groups
Delete User
userdel <user>
-r delete home directory and mail content
Add, remove user from a group
gpasswd <group> -a <user>
gpasswd <group> -d <user>
Show User's group(s)
groups <user>
/etc/shadow
<user>:<password>:<1>:<2>:<3>:<4>:::
- When was the last time this password changes
- User wont be able to change the password 0 days after each change
- After this many days, the user HAVE to change his password
- ...and the user will be informed <4> days before the expiration to change his password
The password field can be:
- :: Without pass can be logged in
- :!: user is deactivated
- :*: user is deactivated
- :253%&^%576: user is activated
- :!253%&^%567: user is locked
Sudo
In debian based systems all the members of group sudo can run commands with root privileges without changing to root user.
Also there is a config file to add users individually /etc/sudoers