10 Linux User Management
10 Linux User Management
/etc/passwd file
/etc/shadow file
useradd
userdel
usermod
chsh
user1:/3GJllg1o4152:11009:0:99999:7:::
Example:
Add a user named prof
useradd -c Course Professor -d /home/prof
-g faculty -G computer, staff -e 2011-12-31
s /bin/bash prof
userdel [options] username
Remove an user from the system
Options
-r
Remove the users home directory and files
contained in it
usermod [options] username
Allows for modifying most of the information stored in
/etc/passwd associated with an user account
several options available to modify almost all of the
information associated with any account, assuming the
user has the right to modify the information
-c
add comments or other information
-d
change home directory if m option is given, the
contents of the users home directory will be moved
to the new home directory, which will be created if
it doesnt exist
-g
change initial group
-G
change supplementary groups which user
is also a member of
-s
change the login shell
-e
The date on which the user account will be
disabled: YYYY-MM-DD
-l
Change login name
-L
Disable/lock users password, which will place a !
before encrypted password in /etc/shadow
-U
Enable/Unlock users password, which will remove the
! from encrypted password in /etc/shadow
chsh [options] username
Changes login shell associated with a user
account
if a shell isnt specified on the command line,
it will prompt for the shell to use
Options
-s
specify the shell to associate to the account
-l
list currently available shells