第四天作業

1 、創建 用戶gentoo ,附加組為bin 和root ,默認shell為/bin/csh ,注釋信息為"Gentoo Distribution"

1
useradd -G bin,root -s /bin/csh -c "Gentoo Distribution" gentoo

2 、創建 下面的用戶、組和組成員關系,名字為 為admins的組

用戶natasha ,使用admins  作為附屬組

用戶harry ,也使用admins  作為附屬組

用戶sarah ,不可交互登錄系統, 且 不是admins的成員,natasha ,harry ,sarah 密碼 都是centos

1
2
3
4
5
6
useradd -G admins natasha
useradd -G admins harry
useradd -r -s /sbin/nologin sarah
echo "centos" |passwd --stdin=natasha
echo "centos" |passwd --stdin=harry
echo "centos" |passwd --stdin=sarah

3、創建testuser uid 1234,主組:bin,輔助組:root,ftp,shell:/bin/csh home:/testdir/testuser

1
useradd -u 1234 -g bin -G root,ftp -s /bin/csh -d /testdir/testuser testuser

4、修改testuser uid:4321,主組:root,輔助組:nobody,loginname:test,home:/home/test 家數據遷移

1
usermod -u 4321 -g 0 -G nobody -l test -md /home/test testuser

5、批量創建帳號:user1…user10

uid:3000-3009,shell:/bin/csh,home:/testdir/username

passwd:usernamepass

注意家目錄相關配置,使用戶正常登錄

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
touch users.txt
vi users.txt
newusers users.txt
touch passwd.txt
vi passwd.txt
cat passwd.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


原創文章,作者:NameLess,如若轉載,請注明出處:http://www.www58058.com/28169

(0)
NameLessNameLess
上一篇 2016-08-04 14:41
下一篇 2016-08-04 14:41

相關推薦

  • 馬哥教育網絡班21期+第4周課程練習

    1、復制/etc/skel目錄為/home/tuser1,要求/home/tuser1及其內部文件的屬組和其它用戶均沒有任何訪問權限。 [root@itop ~]# cp -r /etc/skel /home/tuserl [root@itop ~]# chmod -R&nbsp…

    Linux干貨 2016-08-01
  • ansible實戰示例

    要求:     使用ansible部署以下任務:     (1) 在VS部署主/備模型的keepalived + nginx的負載均衡;     (2) 在RS主機上部署httpd + php + php-mysql;     (3) 在第五臺主機上部署mariadb-serve…

    Linux干貨 2016-11-11
  • useradd的學習小結

    1、作用 創建一個新的用戶賬號或者更新創建用戶時的默認設置。 2、語法 有兩種語法格式,第一種是創建新用戶時,為新用戶設置屬性,而不完全使用/etc/default/useradd默認設置的內容;第二種是設置/etc/default/useradd的內容,即設置創建新用戶時,新用戶具有的默認屬性。 (1)useradd [選項 屬性] 用戶名 如果不加選項,…

    2017-07-22
  • sed大法好

    sed sed概念 (1)基本概念:sed是流編輯器(stream editor),A stream editor is used to perform basic text transformations on an input stream (a file or input from a pipeline).作用就是對輸入的流(文件或者從一個管道輸入的流…

    Linux干貨 2016-12-02
  • web service之http協議

    一.概述 1.web應用的核心是http協議(HyperText Transfer Protocol),http協議的由兩部分組成,客戶端程序和服務器端程序,通過交換http報文進行會話。web頁面則是由對象(也叫資源)組成的,對象直白的說就是一個個的文件,而這些對象可以通過URL引用,URL由兩部分組成,存放對象的主機名和對象的文件路徑,而這些對象都存儲在…

    Linux干貨 2016-11-03
  • 玩轉linux之啟動篇

        想要玩轉linux,首先明白其啟動流程,這里簡單說明一下: CentOS 6啟動流程:    POST –> Boot Sequence(BIOS) –> Boot Loader –> Kernel(ramdisk) –> roo…

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