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

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 14:44
下一篇 2016-08-02 15:24

相关推荐

  • 如何理解云计算中IaaS、PaaS和SaaS?很简单,就像吃货想吃披萨了…

                                                      &nbsp…

    2015-04-17
  • OpenSSL

    一、什么是OpenSSL 在电脑网络上,OpenSSL是一个开放源代码的软件库包,应用程序可以使用这个包来进行安全通讯,避免窃听,同时确认另一端连接者的身份。这个包广泛被应用在互联网的网页服务器上。其主要库是以C语言所写成,实现了基本的加密功能,实现了SSL与TLS协议。 OpenSSL由三部分组成:     libencryp…

    Linux干货 2016-04-25
  • N25 第五周作业

    1、显示/boot/grub/grub.conf中以至少一个空白字符开头的行; 2、显示/etc/rc.d/rc.sysinit文件中以#开头,后面跟至少一个空白字符,而后又有至少一个非空白字符的行; 3、打出netstat -tan命令执行结果中以‘LISTEN’,后或跟空白字符结尾的行; 4、添加用户bash, testbash, basher, nol…

    Linux干货 2017-01-08
  • 群集简介和LVS_nat模式配置

    群集简介: 群集(或集群)和称呼来自于英文单词cluster,表示一群、一串的意思,用在服务器领域则表示大量服务器的集合体,以区分于单个服务器。 根据实际企业环境的不同,群集所提供的功能也各不相同,采用的技术细节也可能各有千秋,但无论哪种群集,都至少包括两台节点服务器。而对外表现为一个整体,只提供一个访问入口(域名或IP地址),相当于一台大型计算机。根据群集…

    Linux干货 2017-02-13
  • 文本处理:三剑客之sed及vim编辑器

    一、sed的用法详解 sed作为Linux的第二招,有着非常强大的文本处理功能。sed是一种在线编辑器、行编辑器,每次处理一行内容。在处理时,sed首先将行放在内存中的一块临时缓冲区,通常配叫做模式空间(pattern space)。如果模式空间的行符合sed的匹配模式则将该行处理后送到标准输出,如果不匹配则不做任何改动送到标准输出。模式空间中一般情况下只会…

    Linux干货 2016-08-12
  • yum函数介绍以及自建yum仓库

    一、前言     在之前介绍了yum的配置(详细请移步 http://www.178linux.com/archives/6445)。但是有没有发现一个问题,虽然我们已将仓库指向一个可用的仓库服务器,但是随着Linux的不断升级和改版,我们是否还需要不断的去修改仓库的配置文件,如果只有一台还好,那如果我们有多…

    Linux干货 2015-07-24

评论列表(1条)

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

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