Linux 第五天: (08月01日) 練習和作業

Linux 第五天: (08月01日) 練習和作業

 

 

 

 

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

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

 

 

創建名為admins的組
用戶natasha, 使用admins作為附屬組
用戶harry, 也是有admins作為附屬組
用戶sarah, 不可交互登錄系統, 且不是admins成員
natasha, harry, sarah密碼都是centos

 

groupadd admins
useradd -G admins natasha
useradd -G admins harry
useradd -s /sbin/nologin sarah
echo "centos" |passwd –stdin natasha
echo "centos" |passwd –stdin harry
echo "centos" |passwd –stdin sarah

 

 

 

創建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

 

 

 

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

 usermod testuser -u 4321 -g root -G nobody -l test -dm /home/test

 

 

 

批量創建帳號 user1…user10
uid:3000-3009, shell:/bin/csh, home:/testdir/username, passwd:usernamepass
注意家目錄相關設置,使用戶正常登錄

 

vi user.txt

 

user1:x:3000:3000::/home/testdir/user1/:/bin/csh
user2:x:3001:3001::/home/testdir/user2/:/bin/csh
user3:x:3002:3002::/home/testdir/user3/:/bin/csh
user4:x:3003:3003::/home/testdir/user4/:/bin/csh
user5:x:3004:3004::/home/testdir/user5/:/bin/csh
user6:x:3005:3005::/home/testdir/user6/:/bin/csh
user7:x:3006:3006::/home/testdir/user7/:/bin/csh
user8:x:3007:3007::/home/testdir/user8/:/bin/csh
user9:x:3008:3008::/home/testdir/user9/:/bin/csh
user10:x:3009:3009::/home/testdir/user10/:/bin/csh

 

newusers user.txt

 

vi pawd.txt

 

user1:user1pass
user2:user2pass
user3:user3pass
user4:user4pass
user5:user5pass
user6:user6pass
user7:user7pass
user8:user8pass
user9:user9pass
user10:user10pass

 

cat pawd.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

 

 

 

 

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

(0)
dengjiandengjian
上一篇 2016-08-08
下一篇 2016-08-08

相關推薦

  • 重定向以及管道

    描述I/O設備的重定向

    Linux干貨 2017-11-19
  • 基于nginx實現7層http的負載均衡

    一、實驗環境實驗環境為三臺服務器:1. nginx負載均衡器1. 內網ip:192.168.11.1002. 外網ip:172.16.251.892. 提供網頁服務的RS-1服務器:192.168.11.2013. 提供網頁服務的RS-2服務器:192.168.11.2024. 拓撲如下:二、實驗配置后臺服務器配置:1. 后臺提供網頁服務的兩臺服務器配置:y…

    Linux干貨 2017-06-29
  • 文件系統掛載

    文件系統掛載 文件系統管理: 將額外文件系統與根文件系統某現存的目錄建立起關聯關系,進而使得此目錄做為其它文件訪問入口的行為稱之為掛載;  解除此關聯關系的過程稱之為卸載;  把設備關聯掛載點:Mount Point mount  卸載時:可使用設備,也可以使用掛載點 umount  注意:掛載點下原有文件在掛載完成后…

    Linux干貨 2015-12-16
  • lvs——特殊的lvs-dr模型

    lvs-dr模型中:vip與dip/rip不在同一網段的實驗環境設計及配置實現 實驗拓撲: 提示:在路由器的內網IP接口上配置一個別名IP,此IP同VIP在同一網段 設計要點: VS上的VIP地址可以直接配置在DIP地址所在的網卡上,Linux主機上,一塊網卡可以配置多個地址 RS上的VIP地址必須配置在lo接口上,并且還要關閉arp的響應和通告功能 外網接…

    Linux干貨 2016-10-26
  • Linux發展史

    Linux發展史 摘要:因為學習linux過程中對整個linux發展歷史只有一些模糊的理解,以本文來對linux發展史進行梳理來加深學習。   一、linux是什么 linux就是一套操作系統,如下圖操作系統就是內核與系統調用接口那 Linux只是一套操作系統并不包含其他應用程序。 Linux提供了一個完整的操作系統當中最底層的硬件控制和資源管理的…

    Linux干貨 2016-10-14
  • N25-第五周博客作業

    1、顯示/boot/grub/grub.conf中以至少一個空白字符開頭的行; [root@localhost ~]# grep "^[[:space:]]\+" /boot/grub/grub.conf      root (hd0,0)…

    Linux干貨 2017-01-06
欧美性久久久久