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

相关推荐

  • 马哥教育网络班22期+第1周课程练习

    第1周课程练习 一、描述计算机的组成及其功能。     CPU (运算器+控制器), 存诸器(内存与外部存储),输入输出设备。      运算器:对数据进行处理(包括算述运算与逻辑运算)。      控制器:负责从存储器取出指令,按指令的要求发出控制信号,使各…

    Linux干货 2016-08-15
  • Linux基础之加密通讯过程详解

    加密通讯过程详解 第一阶段 客户端->服务器端 向服务器声明自己的加密通讯协议版本,ssl或者tls 支持的加密算法 支持的压缩算法 第二阶段 服务器端->客户端 向客户端确认使用的加密通讯协议版本 确认的加密方法 确认压缩方法 服务器端证书 第三阶段 客户端->服务器端 客户端验证服务器端证书 发证机构 证书完整性 证书持有者 证书有效期…

    2017-09-16
  • find命令总结

    用途:     find命令用来在文件层级结构中搜索跟条件匹配的文件 语法:     find [OPTIONS] [查找起始路径] [查找条件] [处理动作]     查找起始路径:指定具体搜索起始路径。默认为当前目录  &nb…

    Linux干货 2016-09-19
  • 编译安装httpd

    编译安装httpd   1 去官网下载源码包                                      为避免非法软件,一定要去官网下载http…

    2017-04-24
  • BIND 配置DNS服务器以及子域授权

    1、安装bind      [root@www ~]# yum -y install bind 2、查看安装生成的文件      [root@www ~]# rpm -ql bind | less 3、程序路径     /var/named 4、配置…

    Linux干货 2016-03-22
  • LVM练习题

    创建一个至少有两个PV组成的大小为20G的名为testvg的 VG;要求PE大小为16MB, 而后在卷组中创建大小为5G的逻 辑卷testlv;挂载至/users目录 第一步!首先准备足够大的硬盘来实验 [root@Cloud /]#lsblk  #添加了/dev/sdb/c硬盘  NAME  &n…

    Linux干货 2017-08-26