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

相关推荐

  • N25期—第一周作业

    计算机的组成及其功能 计算机主要由硬件和软件两部分组成, 硬件目前由5大部件组成 控制器:类似人类的大脑!控制整个计算机的运作 运算器:对数据进行逻辑运算处理 存储器:存放数据部件 输出设备:比如显示器,打印机 输入设备:比如键盘,鼠标 Linux发行版本 主要三大分之:Debian系,Reb Hat系,Slackware系。 1.Debian GNU / …

    Linux干货 2016-12-01
  • inotify+rsync同步方案(ubuntu,适用其他发行版)

    系统:Ubuntu 16.04.1  工具:rsync 3.1.1 、inotify -tools 3.14      作者:jevtse    本文除了软件安装部分,其他内容同样适用其他linux系统;同步目标主机:172.16.250.…

    2017-03-05
  • linux高级文件管理系统

    磁盘配额:    linux是一个多用户的系统,磁盘配额是分配给每个用户的磁盘可用空间的限制。每一用户只能使用最大配额范围内的磁盘空间。root是不受配额限制的,只有普通用户才受限制。   Quota是在RedHatlinux下实现linux磁盘配额的工具,它支持单独的挂载文件系统,而不是一个目录。quota默认是安装的,如果没…

    Linux干货 2016-09-02
  • Linux发展史

    前言     Linux属于类Unix中的一个当下比较流行的操作系统,占领了服务器大部分江山。作为一个专业复杂的操作系统,了解其发展过程是很有必要的。如果要讲linux的历史,肯定是从三个团体开发Multics系统说起,贝尔实验室离开Multics项目后,Tompson和他的同事一起创造了unix,而在unix的各种分支中BSD则是迅速发…

    Linux干货 2016-10-14
  • Linux哲学思想

    一切皆文件(硬件设备亦如此); 由众多目的单一的小程序组成,一个程序只做一件事,并且要好; 组合小程序完成复杂任务; 尽可能避免跟用户交互; 使用文本文件保存配置信息; 提供机制,而非策略。 Linux作为自由软件(GNU),同时也遵循自由软件的思想: 自由使用 自由学习和修改 自由分发 自由创建衍生版

    Linux干货 2016-10-31
  • 循环语句

    冯罗伊曼体系架构 1. 输入设备 2. 输出设备 3. 存储器 4. 运算器 5. 控制器 转义序列:\\, \t , \r , \n , \”,  \’ Python:是动态语言,强类型语言 算数运算符 + – */ % ** /是自然除,//是整除 位运算符 & |  ~  ^  <<  >> 原码 5=&gt…

    Linux干货 2018-03-26