Linux 第五天: (08月01日) 练习和作业

Linux 第五天: (08月01日) 练习和作业

 

 

 

 

创建用户gentoo, 附加组为bin和root, 默认shell为/bin/csh, 注释信息为"Gentoo Distribution"

useradd -G bin,root -c "Gentoo Distribution" -s /bin/csh gentoo ; id gentoo

 

 

创建名为admins的组
用户natasha, 使用admins作为附属组
用户harry, 也是有admins作为附属组
用户sarah, 不可交互登录系统, 且不是admins成员
natasha, harry, sarah密码都是centos

 

groupadd admins
useradd -G admins natasha
useradd -G admins harry
useradd -s /sbin/nologin sarah
echo "centos" |passwd –stdin natasha
echo "centos" |passwd –stdin harry
echo "centos" |passwd –stdin sarah

 

 

 

创建testuser, uid:1234 主组:bin 辅助组:root,ftp, shell:/bin/csh home:/testdir/testuser

 useradd -u 1234 -g bin -G root,ftp -s /bin/csh -d /testdir/testuser testuser

 

 

 

修改testuser, uid:4321 主组:root 辅助组:nobody loginname:test home:/home/test 家数据迁移

 usermod testuser -u 4321 -g root -G nobody -l test -dm /home/test

 

 

 

批量创建帐号 user1…user10
uid:3000-3009, shell:/bin/csh, home:/testdir/username, passwd:usernamepass
注意家目录相关设置,使用户正常登录

 

vi user.txt

 

user1:x:3000:3000::/home/testdir/user1/:/bin/csh
user2:x:3001:3001::/home/testdir/user2/:/bin/csh
user3:x:3002:3002::/home/testdir/user3/:/bin/csh
user4:x:3003:3003::/home/testdir/user4/:/bin/csh
user5:x:3004:3004::/home/testdir/user5/:/bin/csh
user6:x:3005:3005::/home/testdir/user6/:/bin/csh
user7:x:3006:3006::/home/testdir/user7/:/bin/csh
user8:x:3007:3007::/home/testdir/user8/:/bin/csh
user9:x:3008:3008::/home/testdir/user9/:/bin/csh
user10:x:3009:3009::/home/testdir/user10/:/bin/csh

 

newusers user.txt

 

vi pawd.txt

 

user1:user1pass
user2:user2pass
user3:user3pass
user4:user4pass
user5:user5pass
user6:user6pass
user7:user7pass
user8:user8pass
user9:user9pass
user10:user10pass

 

cat pawd.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

 

 

 

 

原创文章,作者:dengjian,如若转载,请注明出处:http://www.178linux.com/28104

(0)
dengjiandengjian
上一篇 2016-08-08 09:22
下一篇 2016-08-08 09:22

相关推荐

  • 2016年8月11号学习博客

    shell脚本编程 shell脚本是包含一些命令或声明,并符合一定格式的文本文件 shell脚本的用途有: 自动化常用命令 执行系统管理和故障排除 创建简单的应用程序 处理文本或文件 命令查询过程:别名–>内部变量–>hash–>$PATH ~]#bash -n 检测脚本语法错误 ~]#bash -x 顺…

    Linux干货 2016-08-15
  • wk_01作业

    计算机 介绍 电子计算机(英语:computer),亦称电脑,是一种利用电子学原理,根据一系列指令对数据进行处理的工具。在现代,机械计算机的应用已经完全被电子计算机所替换,其所相关的技术研究叫计算机科学,而“计算机技术”指的是将计算机科学的成果应用于工程实践所派生的诸多技术性和经验性成果的总合。“计算机技术”与“计算机科学”是两个相关而又不同的概念,它们的不…

    Linux干货 2016-12-04
  • Linux基础知识之IO重定向

    该博文以CentOS6.8_x86_64系统为基础,Xshell 5远程连接CentOS系统,以root身份登录系统。  什么是I/O重定向?       所谓I/O重定向简单来说就是一个过程,这个过程捕捉一个文件,或者命令,程序,脚本,甚至脚本中的代码块(codeblock)的输出,然后把捕捉到的输出,作为输入发送给…

    Linux干货 2016-07-26
  • 安全和加密与创建签名证书

    安全和加密:NIST定义的安全属性:(美国国家标准与技术研究院)保密性:        数据保密性        隐私性完整性:不可篡改        数据完整性        系统完整性高可用性: …

    Linux干货 2017-04-11
  • cat命令了解

    1 查看文件在LINUX下一切皆文件,光看见文件名和目录名对我们来说,还远远不够。今天,就来介绍一下可以打开文件的命令cat。当然,二进制的可执行文件,不能用cat。在CentOS7下,以/etc/profile文件为例,如下: 首先,怎么打开这个文件呢?直接执行:cat /etc/passwd. 这么多行,能不能看见行号呢?cat -n /etc/pass…

    Linux干货 2017-04-03
  • 每日一练 —8.4 文本处理工具,正则表达式

    练习 1 、找出ifconfig 命令结果中本机的所有IPv4 地址 2 、查出分区空间使用率的最大百分比值 3 、查出用户UID 最大值的用户名、UID 及shell 类型 4 、查出/tmp 的权限,以数字方式显示 5 、统计当前连接本机的每个远程主机IP 的连接数,并按从大到小排序   6,显示/proc/meminfo文件中以大写或小写s开…

    Linux干货 2016-08-15