2013年5月24日 星期五

系統全域的 PATH 與 alias 設定

簡單地說會動到以下的設定檔:
  1. /etc/bash.bashrc
  2. /etc/profile 或 /etc/profile.d
  3. /etc/login.defs


首先來看 alias 放不同地方的效果:
  1. 所有的 interactive shell 有效
  2. login shell 有效,用 su 切換的使用者無效

再來是 PATH:
  1. 所有的 interactive shell 有效,X session 無效,su 後無效
  2. su 後無效其他有效
  3. 只有 su 有效

結論:

alias 放 /etc/bash.bashrc

PATH 寫在 /etc/profile 或 /etc/profile.d/*.sh

修改 login.defs 的 ENV_SUPATH 和 ENV_PATH 跟上面同步

沒有留言:

張貼留言