3.4.4. Modifying User Settings
usermodcommand. The logic of using
usermodis identical to
useraddas well as its syntax:
usermod option(s) username
-loption with the new user name (or login).
Example 3.10. Changing User's Login
~]# usermod -l "emily-smith" emily
-loption changes the name of the user from the login
emilyto the new login,
emily-smith. Nothing else is changed. In particular,
emily's home directory name (
/home/emily) remains the same unless it is changed manually to reflect the new user name.
Example 3.11. Changing User's UID and Home Directory
~]# usermod -a -u 699 -d /home/dir_2 robert
-doptions changes the settings of user
robert. Now, his ID is 699 instead of 501, and his home directory is no longer
usermodcommand you can also move the content of the user's home directory to a new location, or lock the account by locking its password.
Example 3.12. Changing User's
~]# usermod -m -d /home/jane -L jane
-doptions used together move the content of
jane's home directory to the
-Loption locks the access to
jane's account by locking its password.
usermodcommand, see the
usermod(8) man page or run
usermod --helpon the command line.