用户组和权限管理相关作业

1创建testuser uid 1234,主组:bin,辅助组:root,ftp,shell:/bin/csh home:/testdir/testuser

    [root@ali ~]# useradd -u 1234 -g bin -G root,ftp -s /bin/csh -d /testdir/testuser testuser

    [root@ali ~]# getent passwd testuser

    testuser:x:1234:1::/testdir/testuser:/bin/csh

    [root@ali ~]# id testuser

    uid=1234(testuser) gid=1(bin) 组=1(bin),0(root),50(ftp)

修改testuser uid:4321,主组:root,辅助组:nobody,loginname:test,home:/home/test 家数据迁移

    root@ali ~]# usermod -u 4321 -g root -G nobody -l test -d /home/test -m testuser

    [root@ali ~]# getent passwd test

    test:x:4321:0::/home/test:/bin/csh

    [root@ali ~]# id test

    uid=4321(test) gid=0(root) 组=0(root),99(nobody)

批量创建帐号:   user1…user10

    uid:3000-3009,shell:/bin/csh,home:/testdir/username

    passwd:usernamepass

    [root@ali ~]# vim user.txt

    [root@ali ~]# newusers user.txt

    [root@ali ~]# tail /etc/passwd

    user1:x:3000:3000::/testdir/user1:/bin/csh

    user2:x:3001:3001::/testdir/user2:/bin/csh

    user3:x:3002:3002::/testdir/user3:/bin/csh

    user4:x:3003:3003::/testdir/user4:/bin/csh

    user5:x:3004:3004::/testdir/user5:/bin/csh

    user6:x:3005:3005::/testdir/user6:/bin/csh

    user7:x:3006:3006::/testdir/user7:/bin/csh

    user8:x:3007:3007::/testdir/user8:/bin/csh

    user9:x:3008:3008::/testdir/user9:/bin/csh

    user10:x:3009:3009::/testdir/user10:/bin/csh

    [root@ali ~]# vim userps.txt

    [root@ali ~]# cat userps.txt | chpasswd

    [root@ali ~]# getent /etc/shadow

1.png

    [root@ali ~]# cp -r /etc/skel/.[^.]* /testdir/user1

    [root@ali ~]# cp -r /etc/skel/.[^.]* /testdir/user2

    

原创文章,作者:M20-1马星,如若转载,请注明出处:http://www.178linux.com/27283

(1)
M20-1马星M20-1马星
上一篇 2016-08-02
下一篇 2016-08-02

相关推荐

  • LVS介绍

    LVS介绍     LVS是linux virtual server的简写,是服务器集群的一种负载均衡解决方案,作为netfilter的补充套件,工作于内核空间。     常见的术语 CIP:客户端ip地址 RIP:后端服务器ip地址 VIP:lvs面向客户端的ip地址 DIP:lvs面向…

    Linux干货 2017-08-04
  • linux用户管理实战

     1、列出当前系统上所有已经登录的用户的用户名,注意:同一个用户登陆多次,则只显示一次即可。 [root@localhost ~]# who |cut -d ‘ ‘ -f1 |sort -u  2、取出最后登陆到当前系统的用户的相关信息。 [root@localhost ~]# who |tail -1  3、取出当前系统上被用户当做…

    2018-02-08
  • 计算机基础知识及基本命令(20170214)

    计算机基础知识 操作系统相关 linux分区介绍 安装linux linux基本命令    一、计算机基础知识       计算机(computer):计算机(Computer):俗称电脑,是一种能接收和存储信息,并按照存储在其内部的程序对海量数据进行自动、高速地处理,然后把处理结果输出的现代化智能电子设备 …

    Linux干货 2017-02-14
  • 脚本初学者

    期待已久的脚本终于在这一周学到了,对于脚本,我感觉就是有两点,第一:考验一个人的思维能力,如果能把你想要的结果用脚本正确的表示出来。第二:以前学的基础命令,怎么组合起来使用。达到以上两点,再难写的脚本都可以写出来的。 一、编写,执行一个脚本        脚本的格式  &nbsp…

    2017-08-05
  • Linux运维学习历程-第十天-文件查找工具

    概述:本篇主要讲解locate命令和find命令,来帮助我们在linux中完成文件查找,方便我们快速定位文件。 一、文件查找    即在文件系统上查找符合条件的文件,常用工具有locate和find  1、locate命令    locate命令其实是find -name的另一种写法,但是要比后者快得多,原因…

    Linux干货 2016-08-21
  • 马哥教育网络班22期+第7周课程练习

    1、创建一个10G分区,并格式为ext4文件系统;    (1) 要求其block大小为2048, 预留空间百分比为2, 卷标为MYDATA, 默认挂载属性包含acl;       [root@localhost ~]#…

    Linux干货 2016-10-09

评论列表(1条)

  • 马哥教育
    马哥教育 2016-08-02 15:21

    完成的不错,但是排版好像不够精美。