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 09:22
下一篇 2016-08-08 09:22

相关推荐

  • RPM软件包管理

                                                RPM 软件包管理 1、rpm软件包管理: &nbs…

    系统运维 2016-09-01
  • 2016 10 19 第5天作业

    20161019第5天作业 软链接和硬链接的区别 硬链接 ①硬链接文件不能跨分区创建 ②一个硬链接文件的删除不影响其他链接的访问 ③链接文件指向的源文件被删除后,链接文件还能正常访问源文件的数据 ④硬链接的文件类型是 –  普通文件 ⑤硬链接和源文件的属性(大小,权限,时间戳,Inode号)相同 ⑥硬链接不能对目录创建 ⑦创建硬链接会增…

    Linux干货 2016-10-20
  • 马哥教育网络班21期+第七周博客作业

    1、创建一个10G分区,并格式为ext4文件系统;    (1) 要求其block大小为2048, 预留空间百分比为2, 卷标为MYDATA, 默认挂载属性包含acl;    (2) 挂载至datamydata目录,要求挂载时禁止程序自动运行,且不更新文件的访问时间戳 [root@ns1 ~]# m…

    Linux干货 2016-08-24
  • linux初识

    一、计算机的组成及其功能: 存储器:    实现记忆功能的部件用来存放计算程序及参与运算的各种数据 运算器:    负责数据的算术运算和逻辑运算即数据的加工处理 控制器:    负责对程序规定的控制信息进行分析,控制并协调输入,输出操作或内存访问 输入设备:    实现计算程序和…

    Linux干货 2016-10-30
  • N22-网络班 第四周作业

    1、复制/etc/skel目录为/home/tuser1,要求/home/tuser1及其内部文件的属组和其它用户均没有任何访问权限。 cp -r /etc/skel /home/tuser1 chmod -R go= /home/tuser1 2、编辑/etc/group文件,添加组hadoop。…

    Linux干货 2016-09-19
  • Linux磁盘知识,分区与文件系统

    硬件设备在Linux系统中的表现     设备文件      I/O Ports: I/O设备地址      一切皆文件:         open(), read(), write(), close()   &nbsp…

    Linux干货 2016-08-29