第四天作业

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

相关推荐

  • 第四周作业

    1、复制/etc/skel目录为/home/tuser1,要求/home/tuser1及其内部文件的属组和其它用户均没有任何访问权限。                 使用到命令chmod &nbsp…

    Linux干货 2017-02-02
  • linux 学习(2)

    1 linux 常见的文件管理命令都有哪些?其常用的使用方法。 ls 文件列出命令   常见选项  -l 显示长文本信息          -d 显示当前目录信息          -a 显示所有文件信息     &nb…

    Linux干货 2016-10-09
  • Linux获取帮助的途径、history命令及文件系统结构

        在学习Linux的过程中,往往会遇到一些难以理解的问,这时我们就需要寻求帮助,下面是获取帮助的几个途径。 一、man(manual)手册(命令) 1、man手册介绍 (1)man手册是系统自带的联机帮助手册,善于利用man命令,可以帮我们解决遇到的大部分问题。 (2)man手册分为九个章节,每个章节是独立的。 章节1:表…

    Linux干货 2016-07-29
  • 集中管理利器-puppet快速入门-下

    Puppet配置 1.    文件管理 file 文件服务器写法: /etc/puppet/ fileserver.conf 定义 [files] path /tmp/files  ## puppet数据存放目录 =è后面远程备份实战会用到 allow *.example.com 实战1: 备份master机…

    Linux干货 2015-05-07
  • ansible-yaml初级语法(hosts、remote_user、tasks)

    环境准备:     1、主控节点IP:172.16.16.9     2、两个被控节点:1)172.16.16.48   2)172.16.16.50     3、hosts配置如下:       &…

    Linux干货 2016-11-28
  • N26-第一周博客作业

    1.描述计算机的组成及其功能 完整的计算机系统由硬件和软件两部分组成。 现在大部分的计算机为冯诺依曼体系,主要有五个组成部分:运算器、控制器、存储器、输入设备、输出设备,以下为详细描述。(计算机的CPU由运算器、控制器和一二三层缓存等构成) 运算器:对数据进行算术运算和逻辑运算(对数据进行加工处理) 控制器:分析指令,控制协调输入、输出操作对内存的访问。 存…

    Linux干货 2017-01-02