第四天作業

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

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

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

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

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

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

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

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 家數據遷移

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

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

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








發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章