手机版
你好,游客 登录 注册 搜索
背景:
阅读新闻

su 与 sudo的区别

[日期:2012-08-23] 来源:Linux社区  作者:liufei_learning [字体: ]

今天在用gvim(Ubuntu 12.04)的时候出现如下错误,以前都没出现这个错误,而且打开时gvim会白屏,等很久才正常显示.刚开始没有在意,google了一下用gvim -f就可以解决,正常使用.

后来使用的时候有出现下面的错误
\GConf-WARNING **: Client failed to connect to the D-BUS daemon:
Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.
google了一下说是没有以 root 身份使用 dbus。

奇怪了,我明明就是root权限。
以前一直用sodu -i 切换到root权限,今天不知怎么的在写一个自动登录的脚本的时候心血来潮用su root 得到root权限,难道这里出问题了?
果然:
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用户的主目录了。

linux
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款