Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Some programs are strange when logged as non-root. [SOLVED]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
Stinky_Foot
n00b
n00b


Joined: 31 Jul 2012
Posts: 27
Location: Piauí, Brazil

PostPosted: Tue Jul 31, 2012 7:55 am    Post subject: Some programs are strange when logged as non-root. [SOLVED] Reply with quote

Hi,

I have just installed Gentoo Linux for the second time in my life, the first one was just a test, I kept hearing people saying about how difficult was to install it and I wanted to try. Now it`s not a test, I am migrating from my beloved Slackware to Gentoo. Also, this is my very first post in this forum too, but I think I am a bit familiar with it because I already found here precious information that helped me out with some installing issues and I think I can say that Gentoo, as Slackware does, have an amazing community.

The point is that I am facing some problems with a few programs that I installed in my Gentoo, and it is that some of them are not launching at all after I change from root to my user account.

Code:
eduardo@gentoo ~ $ gmrun
No protocol specified

(gmrun:1925): Gtk-WARNING **: cannot open display: :0


This is what i got after trying to launch gmrun from terminal (also, it is not responding to Alt+F2). But the funny is, after reboot my system and startx on my user account i was able to launch gmrun (only from terminal) but after logging as root and afterwards logging again with my user account (using as command su -l user, not exit) I was not able anymore to launch gmrun and got that warning again. After using exit for to times in a row and returning to the original user logging I was able again to launch gmrun.

What's happening, guys? :(

Thanks in advance.


Last edited by Stinky_Foot on Fri Jan 18, 2013 7:42 pm; edited 1 time in total
Back to top
View user's profile Send private message
mv
Advocate
Advocate


Joined: 20 Apr 2005
Posts: 4066

PostPosted: Tue Jul 31, 2012 8:12 am    Post subject: Reply with quote

The user who wants to run an X program needs to know the Authority data of the running X session. Classically, this data is kept in the File contained in the XAUTHORITY variable. If you change from the user to root, you can just set this variable to the user's file - the opposite will not work, because the user cannot read root's ~/.Xauthority file.
Again, classically, you can use xauth to generate such data for the session from root for the user (there are scripts like sux or sudox (from the mv overlay) which do this for you).
Meanwhile, unfortunately, xauth is becoming obsoleted in favor of the upcoming GNOME-OS. If you use *kit (consolekit, policykit, systemd, pam) you might need to look up those.
Back to top
View user's profile Send private message
Stinky_Foot
n00b
n00b


Joined: 31 Jul 2012
Posts: 27
Location: Piauí, Brazil

PostPosted: Wed Aug 01, 2012 8:34 pm    Post subject: Reply with quote

I tried to solve the problem setting the same magic cookie value of root to my user with xauth but it didn't worked. Installed pam and rebooted my machine but it didn't helped as well. I searched more trough the web to find what I am missing but couldn't find nothing useful.

Sorry but I'm not so experienced user when it comes to GNU/Linux, and I did not understood why the same login behaves different when I log normally from when I log from root with "su -l user".

Also, sorry for my awful English, I am still learning it too.
Back to top
View user's profile Send private message
mv
Advocate
Advocate


Joined: 20 Apr 2005
Posts: 4066

PostPosted: Thu Aug 02, 2012 5:35 am    Post subject: Reply with quote

Stinky_Foot wrote:
I tried to solve the problem setting the same magic cookie value of root to my user with xauth but it didn't worked.

If your user is locked in, only the user can generate a magic cookie which root can use. Normally, it suffices that root just uses the magic cookie of your user (in which case you do not have to call xauth at all): Call as root
Code:
export XAUTHORITY=~your_user_name/.Xauthority
export DISPLAY=:0 # Perhaps DISPLAY is already set, depending on your startup files
The alternative simple solutions are to use sux or sudox to become root. For the pam/consolekit solution you probably have to configure something in advance - I am not familiar with these. Another possibility is to become root by using ssh -Y (if "X11Forwarding yes" is allowed in /etc/ssh/sshd_config)
Back to top
View user's profile Send private message
Stinky_Foot
n00b
n00b


Joined: 31 Jul 2012
Posts: 27
Location: Piauí, Brazil

PostPosted: Thu Aug 02, 2012 8:07 pm    Post subject: Reply with quote

Much thanks, mv. This seems to get the job done here!
Well, I think I understand why the first command is there, it sets the Xauthority file to both, root and user, get the same one (right?). But the second part, what role plays the "DISPLAY" value?


EDIT: Where do I mark this topic as solved?
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum