su 与 sudo的区别

今天在用gvim(ubuntu12.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用户的主目录了。
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值