用歸檔複製保留所有屬性,再移除組與其他人的權限。-a 等同 -dr --preserve=all:`-d` 不追蹤符號鏈接(只複製鏈接本身),`-r` 遞歸,--preserve=all 保留 mode、ownership、timestamps、context、links、xattr 等全部屬性。
cp -a /etc/skel/ /home/tuser1/ chmod -R go= /home/tuser1/

echo "hadoop:x:666: " >> /etc/group # 或用 vim 編輯 /etc/group,在末尾新增一行 hadoop:x:666: 後存檔

基本組 ID 取 hadoop 組的 GID,家目錄為 /home/hadoop。用 vim 開啟後在命令模式按 G 移到末行,按 o 新增一行:
hadoop:x:500:666:description:/home/hadoop:/bin/bash

cp -a /etc/skel/ /home/hadoop chmod -R go= /home/hadoop

# 方式一 chown -R hadoop /home/hadoop && chgrp -R hadoop /home/hadoop # 方式二 chown -R hadoop:hadoop /home/hadoop

grep "^[sS]" /proc/meminfo grep -i "^s" /proc/meminfo egrep '^s|^S' /proc/meminfo

grep -v "nologin>$" /etc/passwd | cut -d: -f1

grep "bash>$" /etc/passwd | cut -d: -f1

egrep -o "<[0-9]>|<[0-9][0-9]>" /etc/passwd | sort -n | uniq

egrep "^[[:space:]]+.*" /boot/grub/grub.conf

egrep "^#.*([[:space:]]+).*([^[:space:]]+)" /etc/rc.d/rc.sysinit

(內容太多,僅擷取部分。)
netstat -tan | egrep "LISTEN([[:space:]]){0,}$"
useradd bash && useradd testbash && useradd basher \ && useradd -s /sbin/nologin nologin \ && egrep '^([[:alpha:]]+>).*\1$' /etc/passwd

本文出自「Record Mark」博客,謝絕轉載!