twmt 发表于 2005-11-11 10:53:29

非root用户登陆,不执行~/.bash_profile的问

大家好!

我用LFS5.0碰到一个问题,请大家指点。谢谢!

非root用户登陆时系统没有执行~/.bash_profile和~/.bashrc,而是去执行了/etc/profile。
而root用户登陆则执行了/root/.bash_profile 和.bashrc

请问如何使得非root用户执行~/.bash_profile?谢谢!

积木 发表于 2005-11-11 12:29:34

看看你的那两个文件的权限。
一般不会有这样的问题。。。

linky_fan 发表于 2005-11-11 20:47:34


非root用户登陆时系统没有执行~/.bash_profile和~/.bashrc,而是去执行了/etc/profile。
而root用户登陆则执行了/root/.bash_profile 和.bashrc

一个successful的login使用/bin/login并读取/etc/passwd后---------->执行/etc/profile----->寻找/home/user/.bash_profile

以上是login shell的读取过程.

对于non-login shell (也就是不需要输入username and passwd 马上能得到$, 例如直接在命令行输入bash, 启动xterm等), 先读取父环境的参数然后读取/home/user/.bashrc

同意木木的意见, 楼主应该是用root建立的那个文件的, 权限对users应该是不可读的.
页: [1]
查看完整版本: 非root用户登陆,不执行~/.bash_profile的问