Linux 第五天: (08月01日) 练习和作业

Linux 第五天: (08月01日) 练习和作业

 

 

 

 

创建用户gentoo, 附加组为bin和root, 默认shell为/bin/csh, 注释信息为"Gentoo Distribution"

useradd -G bin,root -c "Gentoo Distribution" -s /bin/csh gentoo ; id gentoo

 

 

创建名为admins的组
用户natasha, 使用admins作为附属组
用户harry, 也是有admins作为附属组
用户sarah, 不可交互登录系统, 且不是admins成员
natasha, harry, sarah密码都是centos

 

groupadd admins
useradd -G admins natasha
useradd -G admins harry
useradd -s /sbin/nologin sarah
echo "centos" |passwd –stdin natasha
echo "centos" |passwd –stdin harry
echo "centos" |passwd –stdin sarah

 

 

 

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

 useradd -u 1234 -g bin -G root,ftp -s /bin/csh -d /testdir/testuser testuser

 

 

 

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

 usermod testuser -u 4321 -g root -G nobody -l test -dm /home/test

 

 

 

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

 

vi user.txt

 

user1:x:3000:3000::/home/testdir/user1/:/bin/csh
user2:x:3001:3001::/home/testdir/user2/:/bin/csh
user3:x:3002:3002::/home/testdir/user3/:/bin/csh
user4:x:3003:3003::/home/testdir/user4/:/bin/csh
user5:x:3004:3004::/home/testdir/user5/:/bin/csh
user6:x:3005:3005::/home/testdir/user6/:/bin/csh
user7:x:3006:3006::/home/testdir/user7/:/bin/csh
user8:x:3007:3007::/home/testdir/user8/:/bin/csh
user9:x:3008:3008::/home/testdir/user9/:/bin/csh
user10:x:3009:3009::/home/testdir/user10/:/bin/csh

 

newusers user.txt

 

vi pawd.txt

 

user1:user1pass
user2:user2pass
user3:user3pass
user4:user4pass
user5:user5pass
user6:user6pass
user7:user7pass
user8:user8pass
user9:user9pass
user10:user10pass

 

cat pawd.txt |chpasswd

 

cp -r /etc/skel/.[^.]* /testdir/user1
cp -r /etc/skel/.[^.]* /testdir/user2
cp -r /etc/skel/.[^.]* /testdir/user3
cp -r /etc/skel/.[^.]* /testdir/user4
cp -r /etc/skel/.[^.]* /testdir/user5
cp -r /etc/skel/.[^.]* /testdir/user6
cp -r /etc/skel/.[^.]* /testdir/user7
cp -r /etc/skel/.[^.]* /testdir/user8
cp -r /etc/skel/.[^.]* /testdir/user9
cp -r /etc/skel/.[^.]* /testdir/user10

 

 

 

 

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

(0)
上一篇 2016-08-08 09:22
下一篇 2016-08-08 09:22

相关推荐

  • shell编程循环语法作业

    判断/var/目录下所有文件的类型 [root@www sh.log]# cat typefile.sh  #!/bin/bash #author:DYW #显示目录下文件类型 if [ $# -lt 1 ];then echo "Please&nb…

    Linux干货 2016-08-21
  • M20-1 8月5号作业

    作业:    1、取本机IP地址;    2、取各分区利用率的数值;    3、统计/etc/init.d/functions 文件中每个单词出现的次数,并按频率从高到低显示;    4、/etc/rc.d/init.d/functions或/etc/rc.d/init.d/fu…

    Linux干货 2016-08-15
  • N21 第二周练习

    ####1、Linux上的文件管理类命令都有哪些,其常用的使用方法及其相关示例演示。复制:cp   移动:mv    删除:rm   cp:copy,复制文件或目录</br>  cp [OPTION]… SOURCE… DIRECTORY…

    Linux干货 2016-07-22
  • 常用RAID级别介绍

    RAID是什么         磁盘阵列(Redundant Arrays of Independent Disks,RAID),磁盘阵列是将多个价格便宜的磁盘按照一定的组合方式组成具有高容量的磁盘组,按照不同的组合方式可以达到不同的效果,如:可以提升磁盘的存取效率,可提高磁盘的…

    Linux干货 2016-02-14
  • N25-第二周做业

    一.Linux上的文件管理类命令都有哪些,其常用的使用方法和演示        1.目录管理的命令    mkdir rmdir              1)…

    Linux干货 2016-12-11
  • redis-cli的一些有趣也很有用的功能

    redis-cli我们最常用的三个参数就是-h、-p、-a选项,分配用来指定连接的redis-server的host、port和登录密码。 通过redis-cli –help发现,redis-cli还提供了其他很多的参数和功能。 1)-x-x选项从标准输入(stdin)读取最后一个参数。 比如从管道中读取输入: echo -en “chen.qun” | r…

    Linux干货 2015-03-16