Linux安全网 - Linux操作系统_Linux 命令_Linux教程_Linux黑客

会员投稿 投稿指南 本期推荐: 强烈推荐:Ylmf OS 3.0 正式版发布附迅雷高 XP系统下硬盘安装Fedora 14图文教程
搜索:
您的位置: Linux安全网 > Linux入门 > » 正文

linux用户管理实验3:usermod命令

来源: longmuxiaozi 分享至:

linux用户管理实验3:rmod.html' target='_blank'>usermod命令

[root@linuxso.com ~]# usermod -c 'wwwwwwwww' test11               修改账户的注释信息

 
[root@linuxso.com ~]# grep test11 /etc/passwd                                   
test11:x:600:600:wwwwwwwww:/home/test11:/bin/bash 注意第五个字段的内容
 
[root@linuxso.com ~]# usermod -d /test11 test11                       修改账户的宿主目录
 
[root@linuxso.com ~]# grep test11 /etc/passwd
test11:x:600:600:wwwwwwwww:/test11:/bin/bash              注意第六个字段的内容                  
 
[root@linuxso.com ~]# usermod -e 2009/01/30 test11               修改账户的有效日期
 
[root@linuxso.com ~]# grep test11 /etc/shadow                         
test11:!!:14252:0:99999:7::14274:                           注意第8个字段的内容                           
 
[root@linuxso.com ~]# usermod -f 10 test11                        账户过期10天后永久停权,当值为0时则立刻被停权,当值为-1时则关闭此功能。默认值为-1
[root@linuxso.com ~]# grep test11 /etc/shadow
test11:!!:14252:0:99999:7:10:14274:
 
[root@linuxso.com ~]# usermod -g root test3                      修改账户test3的群组为root
[root@linuxso.com ~]# grep test3 /etc/passwd
test3:x:503:0::/home/test3:/bin/bash                      注意第四个字段的内容变为0了,即root
 
 
[root@linuxso.com ~]# id test3                               查看账户test3id信息
uid=503(test3) gid=0(root) groups=0(root)
[root@linuxso.com ~]# usermod -G sys,adm test3              修改账户test3的次要群组为sysadm
[root@linuxso.com ~]# id test3                               再次查看账户test3id信息,注意结果跟上次结果的变化
uid=503(test3) gid=0(root) groups=0(root),3(sys),4(adm)
 
[root@linuxso.com ~]# usermod -l test33 test3                   test3账户的名字修改为test33
[root@linuxso.com ~]# grep test3 /etc/passwd                  
test33:x:503:0::/home/test3:/bin/bash                    注意第一个字段的内容
 
 
[root@linuxso.com ~]# usermod -s /sbin/nologin test33                   修改test33账户的shell/sbin/nologin
[root@linuxso.com ~]# grep test33 /etc/passwd
test33:x:503:0::/home/test3:/sbin/nologin                      注意第七个字段的内容
 
[root@linuxso.com ~]# usermod -u 555 test33                     修改test33账户的uid555
[root@linuxso.com ~]# grep test33 /etc/passwd                          注意第三个字段的内容
test33:x:555:0::/home/test3:/sbin/nologin
 
 
[root@linuxso.com ~]# usermod -L test33                    锁定账户test33的口令
[root@linuxso.com ~]# passwd -S test33                      查看test33口令的状态
test33 LK 2009-01-07 0 99999 7 -1 (Password locked.) 结果为锁定状态
 
[root@linuxso.com ~]# usermod -U test33                            解锁test33账户的口令
[root@linuxso.com ~]# passwd -S test33                      再次查看test33口令的状态
test33 PS 2009-01-07 0 99999 7 -1 (Password set, MD5 crypt.)

Tags:
分享至:
最新图文资讯
1 2 3 4 5 6
验证码:点击我更换图片 理智评论文明上网,拒绝恶意谩骂 用户名:
关于我们 - 联系我们 - 广告服务 - 友情链接 - 网站地图 - 版权声明 - 发展历史