Unix使用者登陸shell控制檔案(轉)

BSDLite發表於2007-08-11
Unix使用者登陸shell控制檔案(轉)[@more@]幾中常見shell在使用者目錄下的控制檔案

1)korn shell (ksh) - .profile .kshrc

2)bourne shell (sh) - .profile

3)c shell (csh) - .cshrc .login

4)bash shell (bash) - .bash_profile .bash_login .profile

在/etc/skel下,儲存了使用者的shell的模版檔案。用admintool建立使用者時系統不會將模版檔案複製到使用者主目錄,而用useradd命令時系統會將相應使用者設立了的模板複製到使用者主目錄並改名為相應的配置檔案,如果想改變環境,修改這個檔案就可以了.

root的配置檔案在/下,如果沒有,使用者可以自己建立.其他使用者的配置檔案在使用者登陸目錄下.

使用者登陸會先讀系統標準配置檔案,然後讀自己目錄下的檔案,如果使用者設定和預設不同,就改變值,如果使用者沒有設定,就用預設值.

例如:bash進的讀取順序: $HOME/.profile--&gt/etc/profile

bash is a bit different from sh.

whenever the user log in the system, bash will look for .bash_profile; if it doesn't exist, it will look for bash_login; if it still doesn't exist, then it will look for .profile. if it can find none of them, finally it uses /etc/profile.

of course, those files are under ${HOME} except /etc/profile.

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/10617542/viewspace-946063/,如需轉載,請註明出處,否則將追究法律責任。

相關文章