su 和 sudo、su root和su - root 区别

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用户的主目录了。

posted @ 2011-09-14 22:17  莫回头  阅读(14119)  评论(2编辑  收藏  举报