当前时区为 UTC + 8 小时



发表新帖 回复这个主题  [ 3 篇帖子 ] 
作者 内容
1 楼 
 文章标题 : A用户登录桌面shell里切换到B用户不能用gedit打开B创建的文件
帖子发表于 : 2017-03-15 14:49 

注册: 2012-01-08 22:54
帖子: 37
送出感谢: 0 次
接收感谢: 0 次
如题,我想问一个问题。比如我以A用户登录桌面,然后在shell里切换到oracle用户,然后打开oracle家目录下的.profile文件: gedit ./profile
这样子会被拒绝,提示没有权限。这是为什么呢?以oracle用户登录进桌面,能在shell里打开数据库程序,但以A用户登录桌面,然后切换到oracle用户,又打不开,这是什么原因呢?倘若我想以A用户登录桌面,然后切换到oracle用户,也能打开oracle用户的 ./profile文件定义的环境变量,要怎么弄呢?
代码:
# if running bash
if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
        . "$HOME/.bashrc"
    fi
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi
export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12.2.0.1.0
export PATH=$PATH:$ORACLE_HOME/bin


_________________
守得云开见月明


页首
 用户资料  
 
2 楼 
 文章标题 : Re: A用户登录桌面shell里切换到B用户不能用gedit打开B创建的文件
帖子发表于 : 2017-03-15 14:54 
头像

注册: 2011-03-20 13:12
帖子: 4534
地址: 山东省寿光县
系统: Debian
送出感谢: 105
接收感谢: 1001
873792861 写道:
然后打开oracle家目录下的.profile文件: gedit ./profile

建议将执行的命令和回应的结果全部复制贴上来,不要节选。

873792861 写道:
这样子会被拒绝,提示没有权限。

确定是没有权限(Permission denied)?不是 Cannot open display: ?
用 vim/nano 打开行不行?


_________________
Debian 中文论坛 - forums.debiancn.org
欢迎所有 Debian GNU/Linux 用户


页首
 用户资料  
 
3 楼 
 文章标题 : Re: A用户登录桌面shell里切换到B用户不能用gedit打开B创建的文件
帖子发表于 : 2017-03-15 15:16 

注册: 2012-01-08 22:54
帖子: 37
送出感谢: 0 次
接收感谢: 0 次
切换时
代码:
leon@leon-pc:~$ su - oracle
密码:
No protocol specified
xrdb: Resource temporarily unavailable
xrdb: Can't open display ':0'
oracle@leon-pc:~$

代码:
oracle@leon-pc:~$ sudo xhost +
[sudo] oracle 的密码:
access control disabled, clients can connect from any host
oracle@leon-pc:~$
oracle@leon-pc:~$ ls -al|grep profile
-rw-r--r--  1 oracle dba    794 3月  13 20:26 .profile
oracle@leon-pc:~$


用gedit打开家目录下的配置文件,结果是空的
代码:
oracle@leon-pc:~$ gedit ./profile

** (gedit:6033): WARNING **: Couldn't connect to accessibility bus: Failed to connect to socket /tmp/dbus-SF7yGurs7K: 拒绝连接

(gedit:6033): Gtk-WARNING **: Failed to get the GNOME session proxy: The name org.gnome.SessionManager is not owned

(gedit:6033): Gtk-WARNING **: Failed to get the Xfce session proxy: The name org.xfce.SessionManager is not owned

(gedit:6033): Gtk-WARNING **: Failed to get an inhibit portal proxy: The name org.freedesktop.portal.Desktop is not owned

(gedit:6033): Gtk-WARNING **: Theme parsing error: gtk.css:150:54: Using one color stop with linear-gradient() is deprecated.


_________________
守得云开见月明


页首
 用户资料  
 
显示帖子 :  排序  
发表新帖 回复这个主题  [ 3 篇帖子 ] 

当前时区为 UTC + 8 小时


在线用户

正在浏览此版面的用户:Baidu [Spider] 和 4 位游客


不能 在这个版面发表主题
不能 在这个版面回复主题
不能 在这个版面编辑帖子
不能 在这个版面删除帖子
不能 在这个版面提交附件

前往 :  
本站点为公益性站点,用于推广开源自由软件,由 DiaHosting VPSBudgetVM VPS 提供服务。
我们认为:软件应可免费取得,软件工具在各种语言环境下皆可使用,且不会有任何功能上的差异;
人们应有定制和修改软件的自由,且方式不受限制,只要他们自认为合适。

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
简体中文语系由 王笑宇 翻译