Format
/etc/passwd
Username, Password, User ID, Group ID, User ID Info, Home directory, Command/shell
Example:
tom:x:1001:1001:Tom Cruise:/home/zac:/bin/bash
/etc/group
Group name, Password, Group ID, Group List
Example:
sudo:x:27:Lucy,Tom
User and Group Management Files
/etc/passwd
and/etc/group
Add
1 | sudo adduser new_username |
Delete
1 | sudo userdel username |
Edit
To modify the username of a user:
usermod -l new_username old_username
To change the password for a user:
sudo passwd username
To change the shell for a user:
sudo chsh username
To change the details for a user (for example real name):
sudo chfn username
To add a user to the sudo group:
1 | adduser username sudo |
To change the Group setting for a directory
chown {-R} [user]{:group} [file|directory]