8-1作业

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

[root@localhost ~]# useradd -u 1234 -g bin -G root,ftp -s /bin/csh -d /testdir/testuser testuser
[root@localhost ~]# getent passwd testuser
testuser:x:1234:1::/testdir/testuser:/bin/csh

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

[root@localhost ~]# usermod -u 4321 -g root -G nobody -l test -md /home/test testuser
[root@localhost ~]# getent passwd test
test:x:4321:0::/home/test:/bin/csh
[root@localhost ~]# ls -a /home/test/
.  ..  .bash_logout  .bash_profile  .bashrc  .gnome2  .mozilla

3、批量创建帐号:user1…user10 uid:3000-3009,shell:/bin/csh,home:/testdir/username passwd:usernamepass 注意家目录相关配置,使用户正常登录

[root@localhost ~]# vim homework.txt
    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@localhost ~]# newusers homework.txt
[root@localhost ~]# vim homeworkpw.txt
    user1:user1pass
    user2:user2pass
    user3:user3pass
    user4:user4pass
    user5:user5pass
    user6:user6pass
    user7:user7pass
    user8:user8pass
    user9:user9pass
    user10:user10pass
[root@localhost ~]# cat homeworkpw.txt | chpasswd
[root@localhost skel]# cp -r /etc/skel/.[^.]* /testdir/user1 
    ...将/etc/skel目录下的文件分别复制到每个用户家目录
    cp -r /etc/skel/. /testdir/user10

原创文章,作者:pao,如若转载,请注明出处:http://www.178linux.com/28106

(0)
上一篇 2016-08-03 19:05
下一篇 2016-08-03 19:07

相关推荐

  • Greatest Personals Post Alternatives in 2021

    A long time ago, singles would release private ads during the local paper once they desired to satisfy some body brand-new. The classified offer could study something like “S…

    Linux干货 2022-12-21
  • N25 – 第一周博客作业

      1. 描述计算机的组成及其功能2. 按系列罗列Linux的发行版,并描述不同发行版之间的联系和区别3. 描述Linux的哲学思想,并按照自己的理解对其进行解释性描述4. 说明Linux系统上命令的使用格式;详细介绍ifconfig,echo,tty,startx,export,pwd,history,sh…

    Linux干货 2016-11-28
  • grep虐我千百遍,我待grep如初恋

    N21第四周博客作业 1、  复制/etc/skel目录为/home/tuser1,要求/home/tuser1及其内部文件的属组和其它用户均没有任何访问权限。 [root@Centos6 ~]# cp -r /etc/skel /home/tuser1 [root@Centos6 ~]#…

    Linux干货 2016-07-16
  • 编译安装——吐血经验,内附脚本

    程序包编译安装: 源码包:name-VERSION-release.src.rpm         rpm由源码包安装后,使用rpmbuild命令制作成二进制格式的rpm包,而后再安装        &nbsp…

    Linux干货 2016-08-24
  • N21-第五周

    1、显示/boot/grub/grub.conf中以至少一个空白字符开头的行; # grep "^[[:space:]]\+" /etc/grub.conf 2、显示/etc/rc.d/rc.sysinit文件中以#开头,后面跟至少一个空白字符,而后又有至少一个非空白字符的行; # grep&nbs…

    Linux干货 2016-08-15
  • Linux之bash shell脚本编程入门篇(三)之循环以及函数function的使用

    bash shell脚本编程入门篇(三)之循环 什么是循环执行?     将某代码段重复运行多次     重复运行多少次:         循环次数事先已知    &nb…

    Linux干货 2016-08-22