What is meant by usermod command??? How it's used in Linux?? Explain with examples?
usermod command is used to make changes in any of the conditions and characteristics of already existing user account via command line.
'useradd' or 'adduser', is used to create new user accounts in Linux. But after creating new account you need to change some attributes like change user's home directory, login name, login shell, change expiry date and many more, in this case 'usermod' command is used.
Whan we make changes in the user's account, following files are influenced:
/etc/passwd - Account infomation.
/etc/shadow - Secure account information.
/etc/group - Group account information.
/etc/gshadow - Secure group account information.
/etc/login.defs - Shadow password suit configuration.
Lets see the use of usermod command with practical examples.
1. How to add infomation to user account.
'-c' or '--comment' - option is used to give new value of the user's password file comment field. /etc/passwd file will be affected and you can see the comment.
You can check the change with 'grep -E --color' command. Where, grep is used to surrounds the matching pattern with color and '-E' is to interpret pattern as an extended regular expression(ERE).
Adding information on 'rockboom' user.