第四天作业

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上glob用于实现文件名的通配、IO重定向及管道

    Linux中所谓的通配是指,显示以指定条件为条件的文件;即通配的含义是指搜寻以已知条件为前提的目标文件。 常用文件通配符有: 文件通配符 含义 例子 * 任意长度的任意字符 如a*,搜寻所有以a为首的文件名的文件 ? 任意的单一字符 如a?,搜索所有的以a开头的两个字符的文件名的文件 [] 匹配指定范围内的任意的单个字符 如[a-z],匹配任意单个字母(不区…

    Linux干货 2017-04-04
  • 终端的类型

    Linux下的终端是一个连接系统的接口,它有以下几个分类     tty:虚拟终端       tty是Teletype的缩写。Teletype是最早出现的一种终端设备,很象电传打字机(或者说就是),是由Teletype公司生产的。   &nbsp…

    Linux干货 2016-10-20
  • Shell脚本之流程控制语句

    Shell脚本之流程控制语句 1、 if语句 (1)if 条件;then        action1 else        action2 fi  注意:shell里没有缩进要求。 (2)if 条件1;then   …

    Linux干货 2017-04-16
  • http协议

    ##socket套接字– 套接字,进程间通信IPC的一种实现,允许位于不同主机(或同一主机)上不同进程之间进行通信和数据交换。– socketAPI:封装了内核中所提供的socket通信相关的系统调用– socketDomain:根据其所使用的地址– AF_INET:Address Family,Ipv4&#8…

    Linux干货 2017-12-06
  • php 配置

      php php不能单独使用都是与httpd结合使用 结合的方式主要是两种一种为模块方式服务于httpd,一种为单独服务方式服务httpd 两种方式不能共存 安装软件包也不相同 网上有官方中文手册 http://php.net/download-docs.php php对中文的支持需要安装php-mbstring php对mysql的支持需要安装…

    Linux干货 2016-11-01
  • redis主从复制(2)— replication buffer与replication backlog

    1、redis主从复制过程先不解释replication buffer和replication backlog,而先看看redis主从复制的过程。 redis的主从复制分为两个阶段: 1)同步(sync rdb snapshot):slave复制master的某时间点(t)的全量数据,t为master接收到slave的sync命令后执行rdb bgsave的…

    Linux干货 2016-04-05