一. 系統管理的其它命令
1. lspci
功能:獲取外圍設備的信息
格式:lspci
實例:#lspci
2. last
功能:顯示先前用戶登錄信息
格式:last [-數字]
實例:#last 顯示最後一次登錄信息
3. date
功能:顯示系統日期和時間
實例:#date
#date 18:00
4. who/whoami
功能:顯示當前登錄的用戶名
實例:#who
5. id
功能:顯示用戶的詳細信息
格式:id〔參數〕
參數:用戶所有信息 -a
顯示的uid -u
顯示用戶所屬組的Gid -g
顯示用戶附加組 -G
實例:#id
#id -u
6. cal
功能:顯示萬年曆
實例:#cal
#cal 2005
7. env
功能:顯示系的環境變量
格式:env
8. wall
功能:發送廣播信息
格式:wall
實例:#wall
輸入發送內容
ctrl+D發送信息
9. Write
功能:發送信息給指定終端上的用戶
格式:write <終端><用戶名>
實例:#wrte ttg1 root
輸入發送內容………….
ctrl+D
注:/etc/motd用戶的信息公告,放在文件中內容所有的用戶登錄時都可以自動顯示。
10. Chfn
功能:修用戶的finger信息
格式:chfn〔用戶名〕
實例:#chfn〔修改當前用戶的finger信息〕
11. chsh
功能:更改用戶的shell
實例:#chsh ftp1(將ftp1用戶的shell改爲/bin/csh)
New Shell [/bin/bash]: bin/csh (輸入用戶的新shell)
二. 用戶配置文件的熟悉
1./etc/profile
功能:設置系統的環境變量
文件內容:
# /etc/profile
# System wide environment and startup programs, for login setup
# Functions and aliases go in /etc/bashrc
pathmunge () { 設置通用路徑,不同的用戶通用路徑是不一樣
if ! echo $PATH | /bin/egrep -q "(^|:)$1($|:)" ; then
if [ "$2" = "after" ] ; then
PATH=$PATH:$1
else
PATH=$1:$PATH
fi
fi
}
# Path manipulation
if [ `id -u` = 0 ]; then
pathmunge /sbin
pathmunge /usr/sbin
pathmunge /usr/local/sbin
fi
pathmunge /usr/X11R6/bin after
unset pathmunge
# No core files by default
ulimit -S -c 0 > /dev/null 2>&1
USER="`id -un`"
LOGNAME=$USER
MAIL="/var/spool/mail/$USER"
HOSTNAME=`/bin/hostname`
HISTSIZE=1000
if [ -z "$INPUTRC" -a ! -f "$HOME/.inputrc" ]; then
INPUTRC=/etc/inputrc
fi
export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE INPUTRC
for i in /etc/profile.d/*.sh ; do
if [ -r "$i" ]; then
. $i
fi
done
unset i
2. /etc/login.defs
功能:設置用戶口令相關信息
內容:
# *REQUIRED*
# Directory where mailboxes reside, _or_ name of file, relative to the
# home directory. If you _do_ define both, MAIL_DIR takes precedence.
# QMAIL_DIR is for Qmail
#
#QMAIL_DIR Maildir
MAIL_DIR /var/spool/mail
#MAIL_FILE .mail
# Password aging controls:
#
# PASS_MAX_DAYS Maximum number of days a password may be used.
# PASS_MIN_DAYS Minimum number of days allowed between password changes.
# PASS_MIN_LEN Minimum acceptable password length.
# PASS_WARN_AGE Number of days warning given before a password expires.
#
PASS_MAX_DAYS 99999
PASS_MIN_DAYS 0
PASS_MIN_LEN 5
PASS_WARN_AGE 7
#
# Min/max values for automatic uid selection in useradd
#
UID_MIN 500
UID_MAX 60000
#
# Min/max values for automatic gid selection in groupadd
#
GID_MIN 500
GID_MAX 60000
#
# If defined, this command is run when removing a user.
# It should remove any at/cron/print jobs etc. owned by
# the user to be removed (passed as the first argument).
#
#USERDEL_CMD /usr/sbin/userdel_local
#
# If useradd should create home directories for users by default
# On RH systems, we do. This option is ORed with the -m flag on
# useradd command line.
#
CREATE_HOME yes
3. /etc/default/useradd
功能:用戶存放用戶的默認信息
文件內容:
# useradd defaults file
GROUP=100(設置所屬組GID)
HOME=/home(用戶主目錄存放的位置)
INACTIVE=-1 (口令失效後多少天禁用賬號)
EXPIRE=(有效期)
SHELL=/bin/bash(用戶默認shell)
SKEL=/etc/skel(
4. 用戶主目錄的文件
(1).bash_profile用戶的私用配置文件
(2).bash-_istory
(3).bashrc記當用戶函數
(4).bash_input鍵盤選項
三. 系統日誌
1.系統日誌的組成
連接時間日誌:記錄用戶登錄信息
錯語日誌:記錄系統錯誤
進程統計日誌:記當進程運行情況
應用程序日誌:記錄應用程序運行情況
2.Syslog的配置
#vi /etc/syslog.conf
功能:配置syslog服務記錄對象
內容:標識.動作 日誌文件
mail.* /var/Log/mail
標識:
authpriv 登錄認證
cron 報告cron和at的信息
damon 報告xinotd的信息
kern 報告內核信息
lpr 報告打印機信息
mail 報告郵件服務器的信息
* 所有信息
3.查看日誌
# more 日誌文件名