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 09:22
下一篇 2016-08-08 09:22

相關推薦

  • btrfs文件系統介紹

    btrfs文件系統介紹 簡介        Btrfs(B-tree,ButterFS ,Better FS通常念成Butter FS),由Oracle于2007年宣布并進行中的COW(copy-on-write式)文件系統。繼ext3/4文件系統之后linux又有了比較強大的文件系統(btrfs文件系統),btrfs…

    系統運維 2016-04-27
  • 企業面試題

    要求: 將一下數據進行排序(字母部分已小到大排序) 101.37.8.249 wz417-419/wz119-125/wz7-16/wz571/wz544/wz1-6101.37.21.19 wz545/wz453-456/wz441-444116.62.4.21 wz106-118/wz514-516/wz581/wz190-199/wz572101.37…

    Linux干貨 2017-06-27
  • N25期–第六周作業

    請詳細總結vim編輯器的使用并完成以下練習題 1、 復制/etc/rc.d/rc.sysinit文件至/tmp目錄,將/tmp/rc.sysinit文件中的以至少一個空白字符開頭的行的行首加#; %s@^[[:space:]]\{1,\}.*@#&@ 2、 復制/boot/grub/grub.conf至/tmp目錄中,刪除/tmp/grub.conf…

    Linux干貨 2017-01-17
  • shell腳本中if與case使用,查找文件locate與find的使用,壓縮,解壓及歸檔工具

    shell腳本中if與case使用 查找文件locate與find的使用 壓縮,解壓及歸檔工具 執行的循序  順序執行  選擇執行  循環執行 條件語句if if只是一個有含義的詞,不能單獨作為指令使用。 單分支      if 條件判斷:then       &nbs…

    Linux干貨 2016-08-18
  • Linux文本三劍客之grep

    一、定義:                 GREP  :Global search REgular expression and Print out the line的縮寫。是一種強大的文本搜索工具,根據用戶指定的“模式”對目標文本逐行進行匹配檢查;并把匹配的行打印出…

    Linux干貨 2016-04-05
  • 菜鳥教你如何磁盤分區與創建文件系統以及掛載(1)

    何為磁盤分區,為什么要分區?    計算機中存放信息的主要的存儲設備就是硬盤,但是硬盤不能直接使用,必須對硬盤進行分割,分割成的一塊一塊的硬盤區域就是磁盤分區。在傳統的磁盤管理中,將一個硬盤分為兩大類分區:主分區和擴展分區。主分區是能夠安裝操作系統,能夠進行計算機啟動的分區,這樣的分區可以直接格式化,然后安裝系統,直接存放文件。 MBR分…

    Linux干貨 2016-08-27
欧美性久久久久