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.www58058.com/28106

(0)
paopao
上一篇 2016-08-03
下一篇 2016-08-03

相關推薦

  • 第十二周:httpd和lamp

    看了一下作業內容,發現所有的都在51cto上寫過了。這里就不在做了。 畢竟當時幾篇博客寫下來,還是非常繁瑣的,不想在寫。 文檔地址:RHEL6.8編譯安裝LAMP環境:httpd-2.4+mysql5.6+php5.5;基于LAMP環境部署WordPress: http://afterdawn.blog.51cto.com/7503144/1876171 配…

    Linux干貨 2016-12-09
  • Linux運維之路-Linux基礎學習三

    先學會用戶組和文件的屬性,才知道怎么去管理

    Linux干貨 2017-11-26
  • 文本查看、處理工具的應用及組、用戶的相關操作

            一、列出當前系統上所有已經登錄的用戶的用戶名,注意:同一個用戶登錄多次,則只顯示一次即可      查看已經登錄的用戶用“who”命令,為了試驗我用root多登錄了幾次。    &nb…

    2017-07-16
  • 馬哥教育網絡班21期+第7周課程練習

    1、創建一個10G分區,并格式為ext4文件系統;    (1) 要求其block大小為2048, 預留空間百分比為2, 卷標為MYDATA, 默認掛載屬性包含acl; [root@centos ~]# mke2fs -t ext4 -b 2048 -m 2&…

    Linux干貨 2016-08-01
  • 文件查找工具之——find

        前言:Linux一切皆文件,在linux的系統中如果我們需要找到所需的文件,除了一步一步慢慢找,還有一種辦法就是要使用Linux中查找文件工具命令,能讓我們很快定位到我們所需的文件。所以我們必須要學好文件查找工具 一、首先我們先要了解文本搜索和文件查找的區別     文本…

    Linux干貨 2015-07-06
  • DNS域名解析系統搭建(BIND)

        【本文導航】    零、準備工作    一、根域服務器配置    二、com頂級域配置    三、linux.com域主服務器配置(DNS1)    四…

    Linux干貨 2016-12-21
欧美性久久久久