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

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

相关推荐

  • 每日一练 —8.4 文本处理工具,正则表达式

    练习 1 、找出ifconfig 命令结果中本机的所有IPv4 地址 2 、查出分区空间使用率的最大百分比值 3 、查出用户UID 最大值的用户名、UID 及shell 类型 4 、查出/tmp 的权限,以数字方式显示 5 、统计当前连接本机的每个远程主机IP 的连接数,并按从大到小排序   6,显示/proc/meminfo文件中以大写或小写s开…

    Linux干货 2016-08-15
  • N25-第五周博客作业

    1、显示/boot/grub/grub.conf中以至少一个空白字符开头的行; [root@localhost ~]# grep "^[[:space:]]\+" /boot/grub/grub.conf      root (hd0,0)…

    Linux干货 2017-01-06
  • centos 6 配置bind

    BIND BIND(Berkeley Internet Name Daemon)是现今互联网上最常使用的DNS服务器软件,使用BIND作为服务器软件的DNS服务器约占所有DNS服务器的九成[。BIND现在由互联网系统协会(Internet Systems Consortium)负责开发与维护。 DNS是什么 DNS(Domain…

    Linux干货 2016-12-19
  • centos7上实现corosync V2 + pacemaker + pcs | crmsh备忘录

    1、集群配置的前提: 一、时间同步(ntpdate做crontab定时任务) 二、主机名和IP相互解析 三、基于ssh密钥主机互信 #ssh-keygen -t rsa #ssh-copy-id -i   集群的全生命周期管理工具: pcs: agent(pcsd) crmsh: agentless (pssh)     2、安…

    2017-11-15
  • 第五周博客作业

    1、显示当前系统上root、fedora或user1用户的默认shell; [root@localhost ~]# grep -E "^(root|fedora|user1)\>" /etc/passwd | cut -d: -f1,7 roo…

    Linux干货 2017-01-07
  • Linux GNU AWK使用

                                    Linux GNU AWK使用 本章内容: awk介绍 awk基本用法 awk变量 awk格式化 awk操作符 awk条件判断…

    系统运维 2016-10-01

评论列表(1条)

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

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