linux 系统级别的设置(/etc/profile)无效而用户级别设置有效(~/.bashrc)

来源:互联网 发布:apache ab for mac 编辑:程序博客网 时间:2024/06/16 13:39

根据我对linux配置的理解,我再/etc/profile里设置了一些配置,从而为了能给所有用户都有效。包括root用户。

可遗憾的是,最后的表现是/etc/profile里头我的设置都没有效果。(事实上,如果你跑到虚拟终端ubuntu alt+ctrl+f1,此终端下登录后,你会发现你设置的是有效果的)

后来得知原因,这是因为我开的是(gnome 的terminal)(ubunu ctrl+alt+t开启的),该terminal默认不是login shell。故而,不会去读取/etc/profile(login shell会读取一次/etc/profile)。

一种解决方式是,设置gnome terminal为Login shell:edit->profile preference->run command as a login shell.

但此法不建议。因为原则是/etc/profile放一些只需登录的时候执行一次的东西,~/.bashrc放置个性化的东西。

所以,我自己的处理方式,就是再~/.bashrc里头添加一遍我在/etc/profile里头设置的东西。

参考:http://askubuntu.com/questions/40287/etc-profile-not-being-sourced

0 0
原创粉丝点击