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

相关推荐

  • LINUX课堂笔记(第一周)

    2018.03.05 LINUX: 切换虚拟终端:CTRL+ALT+F[1-6] 查看当前得终端设备命令:tty 查看内存: cat /proc/meminfo free -h 查看分区: cat /proc/partitions lsblk 查看CPU: lscpu cat /proc/cpuinfo 查看版本 cat /etc/centos-releas…

    Linux干货 2018-03-15
  • LVS集群类型

     lvs:Linux Virtual Server         l4:四层路由、四层交换          根据请求报文的目标IP和目标PORT将其调度转发至后端的某主机;      IPTABLES:  …

    Linux干货 2017-01-10
  • ifcfg家族命令介绍

    ifcfg家族命令: ifconfig ifconfig [interface] add<地址>:设置网络设备IPv6的ip地址; del<地址>:删除网络设备IPv6的IP地址; down:关闭指定的网络设备;<硬件地址>:设置网络设备的类型与硬件地址; io_addr:设置网络设备的I/O地址; irq:设置…

    Linux干货 2016-07-29
  • 逻辑卷

    LVM是逻辑卷管理(Logical Volume Manager)的简称,它是建立在物理存储设备之上的一个抽象层,允许你生成逻辑存储卷,与直接使用物理存储在管理上相比,提供了更好灵活性。       LVM将存储虚拟化,使用逻辑卷,你不会受限于物理磁盘的大小,另外,与硬件相关的存储设置被其隐藏,你可以不用停止应用或卸载…

    Linux干货 2016-09-01
  • Linux开学一周的学习心得

    Linux,这个名字第一次听到是通过张超老师给我讲解,因为我在学校学的是金融数学,平时对这方面没有太多接触。当时对Linux就知道是个系统,随后在网上搜了搜,了解也不太多。 直到今天已经来马哥教育一星期了,刚入学的这一星期上课,都是一些基本的命令,感觉学着还蛮有意思,教学的安排也非常合理,我们大家学一天还能自己动手操作一天,既能专心听课,又能把学到的知识巩固…

    2017-07-15