cp -r /etc/skel/ /home/tuser1 chmod -R u-r,o-r tuser1/ ll d-wxr-x--x. 2 root root 4096 Aug 14 13:58 tuser1
驗證:切換到 zengzy 後 cd /home/tuser1/ && ls 會出現 Permission denied。
vim /etc/group hadoop:x:499: echo 'hadoop1:x:505:' >> /etc/group
欄位依序為:帳號、密碼佔位、UID、GID、說明、家目錄、shell。
hadoop:x:505:499::/home/hadoop:/bin/bash id hadoop uid=505(hadoop) gid=499(hadoop) groups=499(hadoop)
cp -r /etc/skel /home/hadoop chmod g-r,o-r hadoop/ ll drwx--x--x. 2 root root 4096 Aug 14 14:22 hadoop
chown -R hadoop:hadoop hadoop/ drwx--x--x. 2 hadoop hadoop 4096 Aug 14 14:22 hadoop
grep "^[sS]" /proc/meminfo grep -i "^s" /proc/meminfo
grep -v "/sbin/nologin$" /etc/passwd | cut -d: -f1
grep "/bin/bash$" /etc/passwd | cut -d: -f1
egrep "\<[0-9]{1,2}\>" /etc/passwd
grep --color=auto "\<[0-9]\{1,2\}\>" /etc/passwd
< 與 > 是詞首/詞尾邊界,確保不會比中 100 這類位數。
grep "^[[:space:]]\+" /boot/grub/grub.conf
grep "^#[[:space:]]\+[^[:space:]]\+" /etc/rc.d/rc.sysinit
netstat -tan | egrep "LISTEN|[[:space:]]$"
useradd bash useradd testbash useradd basher useradd -s /sbin/nologin nologin grep --color=auto "^\([[:alnum:]]\+\>\).*\1$" /etc/passwd
這裡的 \1 是反向引用,讓同一行中後段的內容必須與第一個捕獲組相同,正好對應「帳號名=shell 名」這種特殊案例(如 sync、shutdown、halt、bash、nologin)。