第四天作业

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基础知识之screen命令详解

    该博文以CentOS6.8_x86_64系统为基础,Xshell5远程登录CentOS6.8系统,以root身份登录系统,以Xshell5发起screen帮助,用系统命令行界面去连接。 screen命令:         打开新的screen: screen -S [SESSION]   (打开一个名叫hel…

    Linux干货 2016-07-29
  • 2016-08-18博客作业

    case 语句 条件判断语句 case 用 变量引用 in PAT1) 分支1 ;; PAT2) 分支2 ;; … *) 默认分支 ;; esac   case 支持glob 风格的通配符: *       任意长度任意字符 ?    &…

    Linux干货 2016-09-19
  • Linux终端类型

    Linux中各种终端的解释 设备终端   键盘鼠标显示器 物理终端( /dev/console ) )   在Linux 系统中,计算机显示器通常被称为控制台终端(Console)。 虚拟终端(tty :teletypewriters, /dev/tty# # 为[1-6])   tty 可有n 个,Ctrl+Alt+…

    Linux干货 2016-10-13
  • git

    1.1 Git的安装 1.1.1 版本 # cat /etc/redhat-release CentOS release 6.8 (Final) # uname -r 2.6.32-642.4.2.el6.x86_64 # uname -m x86_64 1.1.2 安装 可以直接通过源码安装。先从Git官网下载源码,然后解压,…

    Linux干货 2016-10-31
  • N25-第四周作业

    第四周 1、复制/etc/skel目录为/home/tuser1,要求/home/tuser1及其内部文件的属组和其它用户均没有任何访问权限。 [root@zf ~]# cp -r /etc/skel/ /home/tuser1 [root@zf ~]# chmod -R&nbs…

    Linux干货 2016-12-21
  • Linux命令学习总结:cp命令

    Linux命令学习总结:cp命令 命令简介:      cp命令用来复制文件或目录。指令英文原义:copy,copy files and directories      指令所在路径:/bin/cp 命令语法: cp [OPTION]… [-T]   SO…

    Linux干货 2017-07-23