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)
dengjiandengjian
上一篇 2016-08-08
下一篇 2016-08-08

相关推荐

  • 【26期】Linux第五周学习小总结

        第五周的学习内容很丰富, 从查找到压缩打包,到软件包的管理,其中尤其是以压缩的内容最为丰富,而且庞大的选项让人绝望,那我今天就总结了一下压缩的一些东西,和大家一起分享。     为什么会产生压缩工具呢?因为我们的现在的很多文件会利用到的东西很多,电脑的读存速度也越来越快,一些大的文件在传输和使用上就会很麻烦,虽…

    2017-08-12
  • 马哥教育网络班21期-第六周课程练习

    1、复制/etc/rc.d/rc.sysinit文件至/tmp目录,将/tmp/rc.sysinit文件中的以至少一个空白字符开头的行的行首加#;  # :%s@^[[:space:]]\+@#&@g 2、复制/boot/grub/grub.conf至/tmp目录中,删除/tmp/grub.conf文件中的行首的空白字符; &nb…

    Linux干货 2016-08-15
  • VSFTP通过pam_mysql插件创建进行基于mysql的虚拟用户

      1、对pam_mysql-0.7RC1包进行编译安装 编译安装环境配置 编译安装所需的包如下: ~]#yum -y groupinstall "Development Tools" "Server Platform Development" ~]#yum -y install mariadb-server…

    Linux干货 2016-11-14
  • 计算机和操作系统的一些概念

    一、计算机组成     (一) 硬件         CPU:运算器、控制器、寄存器、缓存器         存储器:主内存,RAM(Random Access…

    Linux干货 2016-08-15
  • linux文件查找工具 — find

    简述:   linux中find命令是一种强大的实时查找工具,它通过用户给出的路径,在该路径下的文件系统中进行文件查找。因此在遍历一个较大的文件系统时会比较花费时间,而且find命令占用资源也是比较大的,所以它的工作特点是,查找的速度略慢,但是可以实现精确查找和实时查找。由于用户权限的问题,可能只搜索用户具备读取和执行权限的目录。由于fi…

    Linux干货 2016-08-18