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 19:05
下一篇 2016-08-03 19:07

相關推薦

  • 第一周 N28

    作業一

    2017-12-03
  • week3

    一,列出當前系統上所有已經登錄的用戶的用戶名,注意,同一個用戶登錄多次只顯示一次即可 who | cut -d' ' -f1 | sort -u 二,取出最后登錄到當前系統的用戶相關信息 who | cut -d'&nb…

    Linux干貨 2016-11-15
  • N25 第三周作業

    1、列出當前系統上所有已經登錄的用戶的用戶名,注意:同一個用戶登錄多次,則只顯示一次即可。 [jizo@jizo ~]$ who | cut -d" " -f1 | uniq jizo  2、取出最后登錄到當前系統的用戶的相關信息。 [root@jizo ~]# who | tail -l jizo     …

    Linux干貨 2016-12-18
  • DNS and BIND 配置指南

    前言     說來接觸Linux也有一年了,BIND是我曾經學習RH系Linux接觸的第一個服務,對我有著莫大的意義,當初差點因為這個服務難以配置而放棄Linux,今天學完馬哥的bind相關系列視頻之后,寫一篇DNS and BIND的基礎到進階。 一、DNS的基礎知識 DNS是什么? DNS(Domain Name …

    Linux干貨 2016-03-21
  • locate、find命令使用總結

    一、簡介    在linux系統中存在"一切皆文件"的說法,這就足以說明文件的重要性,因此查找文件也是我們必須要掌握的技能。這時候熟練使用locate、find命令也就顯得至關重要。尤其是find命令常用于日常工作中如安裝完某個軟件之后要查看這些軟件的安裝配置路徑,或是需要按指定條件直接查找我們需要操作的文件。因此更需…

    Linux干貨 2015-08-31
  • Linux 根文件系統層級結構

    一、Linux根文件系統層級結構圖 二、Linux根文件系統目錄說明

    Linux干貨 2016-09-26
欧美性久久久久