Chinaunix首页 | 论坛 | 博客
  • 博客访问: 325559
  • 博文数量: 72
  • 博客积分: 1730
  • 博客等级: 上尉
  • 技术积分: 743
  • 用 户 组: 普通用户
  • 注册时间: 2012-02-27 18:49
文章分类

全部博文(72)

文章存档

2012年(72)

我的朋友

分类: 系统运维

2012-08-29 14:37:23

转载于:

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目录还是原先用户的目录
但是sudo 或su - root后目录就变为root用户的主目录了。
阅读(2369) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~