linux用户管理-修改用户
admin 发布于:2014-8-12 9:57 分类:Linux 有 1611 人浏览,获得评论 0 条 标签: usermod
[root@WEB66 home]# usermod -h
Usage: usermod [options] LOGIN
Options:
-c, --comment COMMENT new value of the GECOS field (指定一段注释性描述)
-d, --home HOME_DIR new home directory for the user account (指定用户主目录)
-e, --expiredate EXPIRE_DATE set account expiration date to EXPIRE_DATE (自 1/1/1970 起,密码被修改的天数,指定账号的有效期限,缺省表示永久有效 )
-f, --inactive INACTIVE set password inactive after expiration to INACTIVE (指定在密码过期后多少天即关闭该账号)
-g, --gid GROUP force use GROUP as new primary group (指定用户所属的用户组)
-G, --groups GROUPS new list of supplementary GROUPS (指定用户所属的附加组)
-a, --append append the user to the supplemental GROUPS mentioned by the -G option without removing him/her from other groups
-h, --help display this help message and exit (帮助)
-l, --login NEW_LOGIN new value of the login name (修改用户帐号名称)
-L, --lock lock the user account (锁定用户密码,使密码无效)
-m, --move-home move contents of the home directory to the new location (use only with -d) (移动到新目录,无目录时创建)
-o, --non-unique allow using duplicate (non-unique) UID (允许重复UID)
-p, --password PASSWORD use encrypted password for the new password (设置密码)
-s, --shell SHELL new login shell for the user account (指定用户登入后所使用的shell)
-u, --uid UID new UID for the user account (设置UID)
-U, --unlock unlock the user account (解除密码锁定)
Usage: usermod [options] LOGIN
Options:
-c, --comment COMMENT new value of the GECOS field (指定一段注释性描述)
-d, --home HOME_DIR new home directory for the user account (指定用户主目录)
-e, --expiredate EXPIRE_DATE set account expiration date to EXPIRE_DATE (自 1/1/1970 起,密码被修改的天数,指定账号的有效期限,缺省表示永久有效 )
-f, --inactive INACTIVE set password inactive after expiration to INACTIVE (指定在密码过期后多少天即关闭该账号)
-g, --gid GROUP force use GROUP as new primary group (指定用户所属的用户组)
-G, --groups GROUPS new list of supplementary GROUPS (指定用户所属的附加组)
-a, --append append the user to the supplemental GROUPS mentioned by the -G option without removing him/her from other groups
-h, --help display this help message and exit (帮助)
-l, --login NEW_LOGIN new value of the login name (修改用户帐号名称)
-L, --lock lock the user account (锁定用户密码,使密码无效)
-m, --move-home move contents of the home directory to the new location (use only with -d) (移动到新目录,无目录时创建)
-o, --non-unique allow using duplicate (non-unique) UID (允许重复UID)
-p, --password PASSWORD use encrypted password for the new password (设置密码)
-s, --shell SHELL new login shell for the user account (指定用户登入后所使用的shell)
-u, --uid UID new UID for the user account (设置UID)
-U, --unlock unlock the user account (解除密码锁定)
-Z, --selinux-user new SELinux user mapping for the user account
范例: usermod -d /var/loguser -m -g log -G '' -s /sbin/nologin -u 505 -p 123456 -c '我是一个LOG管理员' -e 20000 -f 7 loguser
loguser:x:505:505:我是一个LOG管理员:/var/loguser:/sbin/nologin (/etc/passwd)
www:x:501: (/etc/group)
root:x:0:root (/etc/group)
log:x:505: (/etc/group)
loguser:123456:16113:0:99999:7:7:11656: (/etc/shadow)