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

相关推荐

  • 如何查找Ubuntu系统中占用磁盘最大的那些文件夹

    根据马哥的指导,我们需要用df和du两个磁盘管理命令来查看 先用df来了解磁盘大致的空间情况: 然后用du -sh 某个folder来查看哪个文件夹占用多少空间 然后我们可以用du /homewebown | sort -nr | more 可来定位具体是哪个文件夹占用空间过大。

    Linux干货 2016-11-06
  • 系统管理之网络管理

    今天给大家分享一些网络方面的知识,,这块的知识很重要哦,都是涉及网络最底层的链路和协议,是我们学习大型服务的基础,和前提.希望大家努力理解这方面的内容,今天的内容大概有这几方面: 1.计算机网络概念 2.计算机网络体系结构 3.物理层 4.数据链路层 5.网络层 6.IP地址及子网 7.传输层 8.应用层 计算机网络概念 计算机网络是个发展中的概念和技术,具…

    Linux干货 2016-09-05
  • 马哥linux运维网络班第22期-第一周博客作业

    计算机的组成及其功能 计算机由运算器,控制器,存储器,输入装置和输出装置组成 (1)运算器 对数据进行常规运算(+,-,*,/)和逻辑运算(与,或,非等)及比较位移等操作 (2)控制器 分析从存储器中读出的指令并按预先规定的步奏执行操作 (3)存储器 存储程序和数据信息并实现快速存取 (4)输入设备 把各种类型的信息转换为二进制编码输入进计算机存储起来 (5…

    Linux干货 2016-08-14
  • linux中更改文件权限的实验

      三种基本权限    r 读 数值表示为4 w写 数值表示为2 X 可执行数值表示为1              简单举例: -rw-rw-r–共十个字符,分成四段 第一个字符“-”表示普通文件;这个位置还可能会出现“l”链接;“d”表示目录 第…

    2017-07-15
  • 课堂练习及课后作业(0805文本处理工具)

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

    Linux干货 2016-08-07
  • Linux命令基础

    Linux命令基础

    2018-03-25