su 和 sudo、su root和su - root 區別

 http://apps.hi.baidu.com/share/detail/23473399

 

su - root:


just like login as root, then the shell is login shell,
which mean it will expericene a login process,
usually .bash_profile and .bashrc will be sourced

su   root
like you open an interactive shell in root name,
then only .bashrc will be sourced.

su 和 sudo 的區別:
    1.共同點:都是root用戶的權限;
    2.不同點:su僅僅取得root權限,工作環境不變,還是在切換之前用戶的工作環境;sudo是完全取得root的權限和root的工作環境。

su - root 和 su root(su)有什麼區別?

su - root:表示人以root身份登錄
just like login as root, then the shell is login shell,
which mean it will expericene a login process,
usually .bash_profile and .bashrc will be sourced
su   root:表示與root建立一個鏈接,通過root執行命令
like you open an interactive shell in root name,
then only .bashrc will be sourced.

最直接的區別就是su目錄還是原先用戶的目錄
但是su或su - root後目錄就變爲root用戶的主目錄了。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章