First, usermod modify user information
Usermod-u 111 username #修改用户usermod-G grp2 username #修改用户组usermod-D/home/chinantfy2 username #修改用户家 Catalog Usermod-s/sbin/nologin Username #修改用户shell
A user can belong to multiple groups, but GID has only one
ID username can view user uid with GID and owning group
Usermod-g only one group can be modified
Usermod-g can add multiple groups, with this command followed by several groups, the owning group of the file is the specified group plus the group to which the user was originally built, such as Usermod-g Grp1,user2 Username assumes that the group is USERGRP when the account is established, then the user group is Usergrp,grp1,user2
Second, passwd
passwd can modify the user password, the root user can modify the password of all users, ordinary users can only modify their own password;
Passwd-l username
Can lock the user password, at this time the user can not login, when the cat Etc/shadow to see, password location changed! Beginning
Passwd-u username
Unlock password
Other than that
USERMOD-L username Lock User Password
Usermod-u username Unlocking user
commands to change passwords directly
echo "111222aaa" |passwd--stdin usr2echo-e "111222aaa\n111222aaa\n" |passwd USR2
Iii. mkpasswd Order
Yum Install-y expect
Install packages
mkpasswd
Complex passwords can be generated randomly, default nine-bit
Mkpasswd-l 12
Then specify a password length of 12 bits
-s Specifies the number of special symbols
Linux Learning Notes (12) Usermod, passwd, mkpasswd