2010年8月9日 星期一

profile 系統運作設定檔

系統設定檔
/etc/profile

個人設定檔
~/.profile
~/.bash_profile (ubuntu系統預設不存在此檔)


#系統啟動時就已經執行,在登入之前
1./etc/profile  (users)
2./etc/rc.local (system)

登入

#登入之後才執行
3.~/.profile (只有在登入的時候執行一次
4.~/.bashrc  (在desktop中每開啟一次終端機都執行一次



~/.profile檔預設的內容
=================
#umask 022

#Tip
自己的profile中 預設把profile#掉
作系統管理者時可以把他拿掉改為066
代表你所製作的檔案別人都不能看

# if running bash
# 在啟動時去執行.bashrc這個檔案
if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
        . "$HOME/.bashrc"
    # ".號加空白" 代表去執行這個檔案
    fi
fi

# set PATH so it includes user's private bin if it exists
# 把$HOME/bin 加到PATH環境變數中 ,$HOME/bin為第一順位
# 所以可以在HOME目錄中建立bin目錄放自己寫得程式
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi
=================

例.使用者將桌面環境搞亂
讓該使用者登入時就清空使用者目錄讓他去抓預設檔 (/etc/skel

在此檔加入程式碼 (~/.profile
rm的 -r是強制刪除 -f是不提問
rm -rf /home/username/* /home/username/.??*

沒有留言:

張貼留言