Following are the basic user account management commands
- To create a new user in Linux; different options can be used to modify userId, home directory etc.
useradd
- To delete the user; please note that this command alone will not delete the user home directory. You will have to use option –r to delete user home directory
userdel
- To create a new group
groupadd
- To remove an existing group
groupdel
- To modify user attributes such as user home directory, user group, user ID etc.
usermod
User Files
/etc/passwd
This file has all user’s attributes
cat /etc/passwd
Output:
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/sbin/nologin
daemon:x:2:2:daemon:/sbin:/sbin/nologin
.
.
.
.
.
/etc/shadow
This file contains encrypted user password and password policy
cat /etc/shadow
Output:
root:$xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx:::
bin:*:xxxxxxxxxxx:::
daemon:*:xxxxxxxxxxxxx:::
.
.
.
.
.
/etc/group
All group and user group information
cat /etc/group
Output:
root:x:0:genie
bin:x:1:
daemon:x:2:
.
.
.
.
.