8-1作业

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

[root@localhost ~]# useradd -u 1234 -g bin -G root,ftp -s /bin/csh -d /testdir/testuser testuser
[root@localhost ~]# getent passwd testuser
testuser:x:1234:1::/testdir/testuser:/bin/csh

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

[root@localhost ~]# usermod -u 4321 -g root -G nobody -l test -md /home/test testuser
[root@localhost ~]# getent passwd test
test:x:4321:0::/home/test:/bin/csh
[root@localhost ~]# ls -a /home/test/
.  ..  .bash_logout  .bash_profile  .bashrc  .gnome2  .mozilla

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

[root@localhost ~]# vim homework.txt
    user1:x:3000:3000::/testdir/user1:/bin/csh
    user2:x:3001:3001::/testdir/user2:/bin/csh
    user3:x:3002:3002::/testdir/user3:/bin/csh
    user4:x:3003:3003::/testdir/user4:/bin/csh
    user5:x:3004:3004::/testdir/user5:/bin/csh
    user6:x:3005:3005::/testdir/user6:/bin/csh
    user7:x:3006:3006::/testdir/user7:/bin/csh
    user8:x:3007:3007::/testdir/user8:/bin/csh
    user9:x:3008:3008::/testdir/user9:/bin/csh
    user10:x:3009:3009::/testdir/user10:/bin/csh
[root@localhost ~]# newusers homework.txt
[root@localhost ~]# vim homeworkpw.txt
    user1:user1pass
    user2:user2pass
    user3:user3pass
    user4:user4pass
    user5:user5pass
    user6:user6pass
    user7:user7pass
    user8:user8pass
    user9:user9pass
    user10:user10pass
[root@localhost ~]# cat homeworkpw.txt | chpasswd
[root@localhost skel]# cp -r /etc/skel/.[^.]* /testdir/user1 
    ...将/etc/skel目录下的文件分别复制到每个用户家目录
    cp -r /etc/skel/. /testdir/user10

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

(0)
paopao
上一篇 2016-08-03 19:05
下一篇 2016-08-03 19:07

相关推荐

  • RAID,pv,vg,lv的实验

    首先在虚拟机中添加5块硬盘,以备实验使用,此实验以sdc,sdd,sde,sdf,sdg硬盘为例:     添加硬盘:(不用重新启动虚拟机读取新添加磁盘)             ~]# echo “- – -” > /sys/class…

    Linux干货 2017-03-19
  • 马哥教育网络班22期+第1周课程练习

    一、描述计算机的组成及其功能。 组成:CPU (运算器+控制器),存诸器(内存与硬盘),输入设备,输出设备。 运算器:对数据进行加工处理的部件(包括算述运算与逻辑运算)。 控制器:负责从存储器取出指令,按指令的要求发出控制信号,使各部件协调的,一步步的完成各种操作。 存储器:计算机记忆或暂存数据的部件 输入设备:人机接口,负责输入信息(数据与指令)转成计算机…

    Linux干货 2016-08-15
  • 马哥网络教育班21期-第一周课程练习

      一、计算机的组成及其功能 1.1计算机的组成      1946年美籍匈牙利科学家冯·诺依曼提出存储程序原理,把程序本身当作数据来对待,程序和该程序处理的数据用同样的方式存储,并确定了存储程序计算机的五大组成部分,分别为运算器、控制器、存储器、输入设备和输出设备。 1.2计算机的组成 控制器(Contro…

    Linux干货 2016-07-12
  • day7作业练习

    1、显示当前系统root、mage或wang用户的UID和默认shell  2、找出/etc/rc.d/init.d/functions文件中行首为某单词(包 括下划线)后面跟一个小括号的行  3、使用egrep取出/etc/rc.d/init.d/functions中其基名     v …

    系统运维 2016-08-08
  • 用户管理类命令

    2018-03-18

    Linux干货 2018-03-18
  • 转载:UEFI和BIOS对比

    传统BIOS开机流程     从你按下主机机壳上的电源键,到进入作业系统的期间,储存于主机板上那颗EEPROM(电气可抹除暨可程式化唯读记忆体)里的BIOS便会开始执行以下的工作: 1. 初始化:     当电脑打开,CPU会自行重置为初始状态,准备运作。BIOS boot block(基本输出输入…

    Linux干货 2016-05-01