第四天作业

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

相关推荐

  • 马哥教育网络班21期+第8周课程练习

    1、请描述网桥、集线器、二层交换机、三层交换机、路由器的功能、使用场景与区别。 集线器的主要功能是对接收到的信号进行再生整形放大,以扩大网络的传输距离,同时把所有节点集中在以它为中心的节点上。它工作于OSI(开放系统互联参考模型)参考模型第一层,即“物理层”。 网桥将两个相似的网络连接起来,并对网络数据的流通进行管理。它工作于数据链路层,不但能扩展网络的距离…

    Linux干货 2016-09-19
  • 内核编译

    下载内核并解压:tar -xvf linux-4.14.9.tar.xz -C ./linux/     接下来是    make   config  。 (具体参照    《make   config  的几种类型》) 一般采用  #  make   menuconfig   的方式 是这个样子的: 此处有可能需要几个包,选择最简单的y…

    2018-01-01
  • 创建CA 和申请证书

    创建CA 和申请证书1生成私有CA的私钥:(umask 066;openssl genrsa -out /etc/pki/CA/private/cakey.pem 2048)注:CA的私钥文件必须放在/etc/pki/CA/private/cakey.pem 这个路径里2创建序列号 ,数据库文件touch  /etc/pki/CA/index.tx…

    Linux干货 2017-07-17
  • Homework Week-12 LAMP部署

    1、请描述一次完整的http请求处理过程;     http全称超文本传输协议,属于应用层协议;常见客户端应用是各种浏览器。     一次服务器端完整http请求处理过程:     (1)建立或处理连接:接收请求或拒绝请求;     (2)接收请求:接收来自于…

    Linux干货 2016-12-05
  • 第十三周作业

    “1、建立samba共享,共享目录为/data,要求:(描述完整的过程)   1)共享名为shared,工作组为magedu;   2)添加组develop,添加用户gentoo,centos和ubuntu,其中gentoo和centos以develop为附加组,ubuntu不属于develop组;密码均为用户名; …

    Linux干货 2017-08-13
  • vim编辑器及shell基础

    1、复制/etc/rc.d/rc.sysint文件至/tmp目录,将/tmp/rc.sysinit文件中的以至少一个空白字符开头的行的行首加#cp /etc/rc.d/rc.sysint /tmpvim /tmp/rc.sysint:%s@^[[:space:]]\+@#&@g 2、复制/boot/grub/grub.conf至/tmp目录中,删除/…

    Linux干货 2017-12-08