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

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

相关推荐

  • 编译内核——制作最适合自己系统的内核

    编译内核: ·程序包的编译安装:         ./configure ,make ,make install ·前提:开发环境(开发工具、开发库),头文件:/usr/include ·开源:源代码–>可执行格式    &nbsp…

    Linux干货 2016-09-11
  • linux下安装配置DHCP服务器

    前提是已经安装了 core 及 base 两个组   1 2 3 4 5 # cat /etc/redhat-release   Red Hat Enterprise Linux Server release 6.8 (Santiago)&…

    Linux干货 2017-05-03
  • 系统基础之权限管理作业题

    1.问题:  在/data/testdir里创建的新文件自动属于g1组,组g2的成员如: alice能对这些新文件有读写权限,组g3的成员如:tom只能对新文件有读权限,其它用户(不属于g1,g2,g3)不能访问这个文件夹。 [root@wen-7 testdir]# mkdir -p /data/…

    Linux干货 2016-08-04
  • 运维监控大数据的提取与分析

    本文内容整理来自【敏捷运维大讲堂】蒋君伟老师的线上直播分享。分别从以下3个维度来分享:1、云时代监控分析的窘境;2、使用标签标记监控数据的维度;3、监控数据应用场景。 云时代监控分析的窘境 在虚拟化与容器技术广泛应用的情况下,运维对象大规模地增长,监控平台每天存储的指标都以亿计,所以监控数据如今已经成了大数据。传统的监控工具在这种场景下,对于数据的提取分析,…

    系统运维 2017-01-09
  • 第四周练习

    1、复制/etc/skel目录为/home/tuser1, 要求/home/tuser1及其内部文件的属组和其它用户均没有任何访问权限。 cp -r /etc/skel /home/tuser1 chmod -R 700 /home/tuser1 2、编辑/etc/group文件,添加组hadoop。 vi /etc/group hadoop:x:2017 …

    Linux干货 2017-08-04
  • shell三剑客之grep

    正则表达式是对字符串操作的一种逻辑公式,就是用事先定义好的一些特定字符、及这些特定字符的组合,组成一个“规则字符串”,这个“规则字符串”用来表达对字符串的一种过滤逻辑。 给定一个正则表达式和另一个字符串,我们可以达到如下的目的: 1. 给定的字符串是否符合正则表达式的过滤逻辑(称作“匹配”); 2. 可以通过正则表达式,从字符串中获取我们想要的特定部分。 正…

    Linux干货 2016-08-08

评论列表(1条)

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

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