1、復制/etc/skel目錄為/home/tuser1,要求/home/tuser1及其內部文件的屬組和其它用戶均沒有任何訪問權限。
cp -r /etc/skel /home/tuser1 chmod -R go-rwx /home/tuser1
2、編輯/etc/group文件,添加組hadoop。
vi /etc/group #編輯模式下輸入G,跳轉至末行,然后輸入o在下方打開一個新行 然后輸入"hadoop:x:777" ESC切換到編輯模式,鍵入“:”切換到末行模式,輸入wq,保存退出
3、手動編輯/etc/passwd文件新增一行,添加用戶hadoop,其基本組ID為hadoop組的id號;其家目錄為/home/hadoop。
vi /etc/passwd #編輯模式下輸入G,跳轉至末行,然后輸入o在下方打開一個新行 輸入“hadoop:x:777:777::/home/hadoop:/bin/bash” #ESC切換到編輯模式,鍵入“:”切換到末行模式,輸入wq,保存退出
4、復制/etc/skel目錄為/home/hadoop,要求修改hadoop目錄的屬組和其它用戶沒有任何訪問權限。
cp -r /etc/skel /home/hadoop chmod go-rwx /home/hadoop
5、修改/home/hadoop目錄及其內部所有文件的屬主為hadoop,屬組為hadoop。
chown -R hadoop:hadoop /home/hadoop
6、顯示/proc/meminfo文件中以大寫或小寫S開頭的行;用兩種方式;
grep ^[s,S] /proc/meminfo
grep -i ^s /proc/meminfo
7、顯示/etc/passwd文件中其默認shell為非/sbin/nologin的用戶;
cat /etc/passwd | grep -v "/sbin/nologin"|cut -d: -f1
8、顯示/etc/passwd文件中其默認shell為/bin/bash的用戶;
cat /etc/passwd|grep "/bin/bash" | cut -d: -f1
9、找出/etc/passwd文件中的一位數或兩位數;
cat /etc/passwd|grep -o "\b[0-9]\{1,2\}\b"
10、顯示/boot/grub/grub.conf中以至少一個空白字符開頭的行;
grep "^\s\+" /boot/grub/grub.conf
11、顯示/etc/rc.d/rc.sysinit文件中以#開頭,后面跟至少一個空白字符,而后又有至少一個非空白字符的行;
grep "^#\s\+\S\+" /etc/rc.d/rc.sysinit
12、打出netstat -tan命令執行結果中以‘LISTEN’,后或跟空白字符結尾的行;
netstat -tan|grep "LISTEN\s*$"
13、添加用戶bash, testbash, basher, nologin (此一個用戶的shell為/sbin/nologin),而后找出當前系統上其用戶名和默認shell相同的用戶的信息;
useradd bash useradd testbash useradd basher useradd nologin -s /bin/nologin egrep "^(\w+).*\1$" /etc/passwd sync:x:5:0:sync:/sbin:/bin/sync shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown halt:x:7:0:halt:/sbin:/sbin/halt nobody:x:99:99:Nobody:/:/sbin/nologin nfsnobody:x:65534:65534:Anonymous NFS User:/var/lib/nfs:/sbin/nologin ntp:x:38:38::/etc/ntp:/sbin/nologin bash:x:501:501::/home/bash:/bin/bash basher:x:502:502::/home/basher:/bin/bash nologin:x:504:504::/home/nologin:/sbin/nologin
原創文章,作者:Stone,如若轉載,請注明出處:http://www.www58058.com/21681
寫的很好,排版也很棒,但是有的題目有些小瑕疵,加油