歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux編程 >> SHELL編程 >> Unix用戶登陸shell控制文件

Unix用戶登陸shell控制文件

日期:2017/2/25 10:13:08   编辑:SHELL編程
幾中常見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-->/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.
Copyright © Linux教程網 All Rights Reserved