My Profile

Keep Up to Date:
Blog RSS
Blog
Forum RSS
Forum
Post New Topic Post Reply
Posted 9 Months, 2 Weeks ago
sorrsuki
Senior Boarder
Posts: 74
graphgraph
User Offline
 
I know it's OT here, but I haven't found a satisfying explanation elsewhere, so I'll try here . After having been pampered by mandrake for years, now that I'm using a real distro I find that some of the things I used to take for granted are not there. When I 'su -' to root, I can't run X apps. On other ngs I found a workaround, i.e. to type a bunch of commands everytime. My question is, how do I automate it, so that everytime I 'su' to root I can run apps under X (the same way it works with Mandrake, Redhat, etc)?

Thank you

Marcello, Gentoo user
The administrator has disabled public write access.
Posted 9 Months, 2 Weeks ago
fidofido
Senior Boarder
Posts: 78
graphgraph
User Offline
 
Here's what I did: I logged on as root, typed 'xhost +localhost'; logged out, re-logged in as a normal user and su'ed to root. I tried launching Kwrite (or any other X app) and I got this error message:

kwrite: cannot connect to X server

Basically, I think I dont undersatnd what xhost does. I thought it added the current user to the list of those that have permission to use X. Wrong?

BTW, I dont have the /etc/X*.hosts files mentioned in the man page Thank you
The administrator has disabled public write access.
Posted 9 Months, 2 Weeks ago
dsojda
Expert Boarder
Posts: 85
graphgraph
User Offline
 
If it says

Cannot open display ''

Then try putting

DISPLAY=0:0.0

In /etc/env.d/00basic

You may need to restart to get it to work (I know there is probably a much better way, but I am no expert!)
The administrator has disabled public write access.
Posted 9 Months, 2 Weeks ago
johngnova
Senior Boarder
Posts: 70
graphgraph
User Offline
 
Just remember that you won't be getting the $PATH environment for
The administrator has disabled public write access.
Posted 9 Months, 2 Weeks ago
johndippel
Senior Boarder
Posts: 72
graphgraph
User Offline
 
Do you have the 'sux' command? It will do just what you need
The administrator has disabled public write access.
Posted 9 Months, 1 Week ago
Howard
Senior Boarder
Posts: 69
graphgraph
User Offline
 
On 17 Jun 2002 14:45:45 -0400, Billy O'Connor assert()ed:

Yep, that's the worst part.
The administrator has disabled public write access.
Posted 9 Months, 1 Week ago
Ns Ehrlich
Senior Boarder
Posts: 67
graphgraph
User Offline
 
There are 3 ways to do what you want (choice is good ):

1/ If you have an .Xauthority file in your $HOME, just make sure the root version of .Xauthority is the same as your users .Xauthority. Copying, linking,... (note that it is possible that some script regenerates .Xauthority reguarly).

2/ Another possibility is to change /etc/ssh/sshd_config, find X-Forwarding, and set it to yes, or true, or whatever. Instead of typing

Restart sshd, or do a killall -HUP sshd (I think).

Note: if you enable X forwarding in your sshd, you will also be able to run a X program, on any X-display in the world! (in a secure reason). I sometimes use it to check my mail on another computer. (my mailprogram runs at home, but displays on some other pc).

3/ xhost +localhost will add 'localhost' to the list of ips that is allowed to connect to your xserver. You need to run this command every time you login. Put it in your .xsession or your .xinitrc.

In order of preference: ssh, xauthority, xhost. Ssh is the most secure way.

And I just thought of something else: xsu/kdesu. Third party program you can find on freshmeat. Run an x-application as another user.
The administrator has disabled public write access.
Posted 9 Months, 1 Week ago
Steven_Osteon
Senior Boarder
Posts: 62
graphgraph
User Offline
 
Tried ln -s ~/.Xauthority /root, same error :cannot connect to X server

Ok, in /etc/sshd_config I set the following: Host * ForwardAgent yes ForwardX11 yes

then i invoked topone root # /etc/init.d/sshd restart * Stopping sshd... [ ok ] * Starting sshd... [ ok ]

<ctrl -D>

Last login: Mon Jun 17 21:57:43 2002 from localhost topone root # kwrite kwrite: cannot connect to X server

I tried various combinations of commandline options, but no joy

Ok, xhost works only if I set the DISPLAY variable after I become root. Since in Gentoo there is no .bashrc file (??) and the one I created seems to be ignored, I ended up putting the line 'export DISPLAY=tried ln -s ~/.Xauthority /root, same error :cannot connect to X server

Ok, in /etc/sshd_config I set the following: Host * ForwardAgent yes ForwardX11 yes

then i invoked topone root # /etc/init.d/sshd restart * Stopping sshd... [ ok ] * Starting sshd... ried ln -s ~/.Xauthority /root, same error :cannot connect to X server

Ok, in /etc/sshd_config I set the following: Host * ForwardAgent yes ForwardX11 yes

then i invoked topone root # /etc/init.d/sshd restart * Stopping sshd... [ ok ] * Starting sshd... [ ok ]

<ctrl -D>

Last login: Mon Jun 17 21:57:43 2002 from localhost topone root # kwrite kwrite: cannot connect to X server

I tried various combinations of commandline options, but no joy

Ok, xhost works only if I set the DISPLAY variable after I become root. Since in Gentoo there is no .bashrc file (??) and the one I created seems to be ignored, I ended up putting the line 'export DISPLAY=tried ln -s ~/.Xauthority /root, same error :cannot connect to X server

Ok, in /etc/sshd_config I set the following: Host * ForwardAgent yes ForwardX11 yes

then i invoked topone root # /etc/init.d/sshd restart * Stopping sshd... [ ok ] * Starting sshd... [ ok ]

<ctrl -D>

Last login: Mon Jun 17 21:57:43 2002 from localhost topone root # kwrite kwrite: cannot connect to X server

I tried various combinations of commandline options, but no joy

Ok, xhost works only if I set the DISPLAY variable after I become root. Since in Gentoo there is no .bashrc file (??) and the one I created seems to be ignored, I ended up putting the line 'export DISPLAY=topone:0.0' in my /etc/profile, and it works. But as Roy Culley pointed out (and you seem to agree, since you put the xhost option at the end of the list) using xhost is not good.

Any suggestions? (sorry if this is becoming boring)
The administrator has disabled public write access.
Posted 9 Months, 1 Week ago
paydayloan
Senior Boarder
Posts: 65
graphgraph
User Offline
 
If you do it will ignore everything after the plus and open X up to the entire universe. 'man xhost' explains that little tidbit, though not quite the same syntax. It shows it as 'xhost +' instead. That amounts to the same thing.
The administrator has disabled public write access.
Posted 9 Months, 1 Week ago
Meta-Memestream
Senior Boarder
Posts: 64
graphgraph
User Offline
 
What's the output of 'echo $DIPLAY' give you?
The administrator has disabled public write access.
 
Copyright © 2006 - Dec 2008 My Linux Gang