第四天作业

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

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

2 、创建 下面的用户、组和组成员关系,名字为 为admins的组

用户natasha ,使用admins  作为附属组

用户harry ,也使用admins  作为附属组

用户sarah ,不可交互登录系统, 且 不是admins的成员,natasha ,harry ,sarah 密码 都是centos

1
2
3
4
5
6
useradd -G admins natasha
useradd -G admins harry
useradd -r -s /sbin/nologin sarah
echo "centos" |passwd --stdin=natasha
echo "centos" |passwd --stdin=harry
echo "centos" |passwd --stdin=sarah

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

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

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

1
usermod -u 4321 -g 0 -G nobody -l test -md /home/test testuser

5、批量创建帐号:user1…user10

uid:3000-3009,shell:/bin/csh,home:/testdir/username

passwd:usernamepass

注意家目录相关配置,使用户正常登录

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
touch users.txt
vi users.txt
newusers users.txt
touch passwd.txt
vi passwd.txt
cat passwd.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


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

(0)
NameLessNameLess
上一篇 2016-08-04 14:41
下一篇 2016-08-04 14:41

相关推荐

  • 网络管理实战(子网划分、单网卡多IP、多网卡单IP、Linux路由实现)

        1、某公司申请到一个C 类IP 地址,但要连接6 个的子公司,最大的一个子 公司有26 台计算机,每个子公司在一个网段中,则子网掩码应设为?          分析过程:C类地址标准的掩码为24位,因为有6个子公…

    Linux干货 2016-09-05
  • 分区块基本知识点及侧重点 — 上

        我们需要熟练了解磁盘分区原理。元数据及块设备对应inode是最重要也是最基本的原理。后面分区很多地方都和inode有关系。    一个磁盘片有63扇区,1024存储位,256个磁头,每个扇区只有前512字节是有效存储单元。所以后面磁盘清零都是跟512这个数字有关。    数据分数据区和元数据…

    Linux干货 2016-08-24
  • 永远不要让自己停下

    曾几何时,我还是刚出象牙塔的小男孩。想想现在,经过4年的洗礼,我不再是小男孩了。可是,我却发现自己变得越来越懒,守着那丁点的知识。 我早已坐吃山空而不自知,早已落后于时代的趋势而不自知。时代需要一个勤奋而专注的我,需要一个不懈怠的我。 如果,我不继续前进,等待我的只有堕落。逆水行舟不进则退,不逼自己一把,永远不知道自己的潜力有多大。 我希望说,再见,懈怠而懒…

    Linux干货 2016-10-07
  • 马哥教育网络班20期+第3周课程练习

    1、列出当前系统上所有已经登录的用户的用户名,注意:同一个用户登录多次,则只显示一次即可。 [root@localhost ~]# who | cut -d" " -f1 | sort -u 2、取出最后登录到当前系统的用户的相关信息。 […

    Linux干货 2016-06-26
  • 不作死就不会死,运维的危险命令(2)

    命令是一种很有趣且有用的东西,但在你不知道会带来什么后果的时候,它又会显得非常危险。所以,在输入某些命令前,请多多检查再敲回车。

    2017-12-03
  • 马哥教育网络班21期+第5周课程练习

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

    Linux干货 2016-08-08