第四天作业

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

相关推荐

  • Linux软件包管理

    一、rpm包管理工具 1、rpm包简介 rpm是redhat的软件包管理器。rpm包管理器全称rpm: Redhat Package Manager RPM  Package Manager。它的软件包后缀也为.rpm。除此外,debian,deb文件有dpkg包管理器。 rpm包的命名方式: 源代码:name-version.tar.{gz|bz…

    Linux干货 2016-08-21
  • CentOS7修改网卡为eth0

    1.编辑网卡信息 [root@linux~]# cd /etc/sysconfig/network-scripts/  #进入网卡目录 [root@linux~network-scripts]# mv ifcfg-eno16777728 ifcfg-eth0  #重命名网卡名称 [root@linux network-…

    Linux干货 2016-10-25
  • 开始学习总结的一些基本知识点

       第一VNC软件(面授班课堂用的),这款软件采用C/S架构(client/sever客户端和服务器端)还有VNC协议(virtual Network computing虚拟网络计算)协议。虽说这款软件对网络班没有实际用途,但自己了解下这款软件的构成也是不错的。    第二开始学习需要的虚拟机软件其中包括VMWARE…

    Linux干货 2016-10-29
  • 系统管理和内核管理(二)之grub使用、编译安装内核

    系统管理和内核管理(二)之grub使用、编译安装内核   回顾CentOS 6启动流程: POST –> Boot Sequence(BIOS) –> Boot Loader –> Kernel(ramdisk) –> rootfs–> switchroot&…

    Linux干货 2016-09-15
  • 创建yum源及httpd源码编译

    创建yum源及源码编译httpd yum本身相比于rpm来说,能够将有依赖的包文件一次性的安装完成,是相当的方便的。 yum的服务器支持的几种格式: http、https、ftp、file 1、yum基础命令 1、yum命令 yum [options] [command] [package …] [options]: 基本不用 [command]: re…

    Linux干货 2017-08-08
  • 软件包管理(rpm篇)

    软件包管理(rpm篇)静态和动态链接    链接主要作用是把各个模块之间相互引用的部分处理好,使得各个模块之间能够正确地衔接,分为静态链接和动态链接    静态链接        把程序对应的依赖库复制一份到包&nbsp…

    Linux干货 2017-04-24