第四天作业

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
下一篇 2016-08-04

相关推荐

  • 关于touch/>/>>创建同名文件的总结

    一、简介 1、touch     即创建文件或修改文件时间     语法:touch [options] file-list 2、>     创建文件,可直接把内容生成到指定文件,会覆盖源文件中的内容;也可以直接生成一个空白文件。     语法:> file…

    2017-02-18
  • FHS文件结构

    我们在前面学习的过程中有了解到,linux的发现版有很多种类型,那么如果每个版本都有着自己的想法去配置文件应该放置的目录,那么将造成管理上的困扰,于是为了解决这个问题,就有了FHS标准。 1.1 FHS 结构 1.1.1 软件的概念 之前,我们提到过,一个完整的计算机系统应该有两部分组成,即:计算机系统=软件+硬件。没有软件的硬件,计算机只不过是一堆只会发热…

    Linux干货 2016-10-27
  • Linux的获取系统的帮助信息及man文档说明

    Linux的获取系统的帮助信息及man文档说明 帮助命令有内部命令帮助和外部命令帮助两种 内部命令获得帮助使用下面命令 # help COMMAND 例如: [root@localhost ~]# type type type is a shell builtin [root@localhost ~]# help type type: type [-afpt…

    2018-02-28
  • 机器学习排序

     从使用的数据类型,以及相关的机器学习技术的观点来看,互联网搜索经历了三代的发展历程。        第一代技术,将互联网网页看作文本,主要采用传统信息检索的方法。        第二代技术,利用互联网的超文本结构,有效…

    Linux干货 2015-12-15
  • bash脚本编程

    1、写一个脚本,判断当前系统上所有用户的shell是否为可登录shell;分别统计这两类用户的个数;通过字符串比较来实现; #!/bin/bash declare -i loginSum=0; declare -i nologinSum=0; for x in `cat /etc/passwd|cut -d: -f 7` do if [ “/sb…

    Linux干货 2017-10-31
  • 从Linux小白到大牛——与狼共舞的日子4

    马哥教育网络班21期+第4周课程练习 1、复制/etc/skel目录为/home/tuser1,要求/home/tuser1及其内部文件的属组和其它用户均没有任何访问权限。 [root@localhost ~]# cp -a /etc/skel/ /home/tuser1/ [root@localhost&n…

    Linux干货 2016-08-02