LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 11-17-2008, 06:51 PM   #1
BrianK
Senior Member
 
Registered: Mar 2002
Location: Los Angeles, CA
Distribution: Debian, Ubuntu
Posts: 1,334

Rep: Reputation: 51
how to open X windows after su'ing to another user?


I have some users who have some problems that are specific to their machine. In order to test, I have to open a GUI on their machine as their user, but if I ssh as root (with -X option) to their machine so I can su to them, I can no longer launch Xwindows... I get the message:

X11 connection rejected because of wrong authentication.
Connection lost to X server `localhost:10.0'

I thought that meant I just had to set the DISPLAY env var, but that either isn't the problem, or I don't know the value to set. I was trying my_machine:0.0 as the DISPLAY var - but that gives a new message about Cannot connect to X server on my_machine:0.0" - maybe 0.0 is not the right number?

For the record, I can open X windows after sshing, just not after sshing then suing.

ideas?

Last edited by BrianK; 11-17-2008 at 06:56 PM.
 
Old 11-17-2008, 07:15 PM   #2
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,187

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
Did you try the -Y option instead of the -X one? Since you're "root," the -X restrictions might not apply, but after the su you're no longer "root," eh?

Just a guess - I never use ssh on my one-person laptop.
 
Old 11-17-2008, 07:31 PM   #3
BrianK
Senior Member
 
Registered: Mar 2002
Location: Los Angeles, CA
Distribution: Debian, Ubuntu
Posts: 1,334

Original Poster
Rep: Reputation: 51
Quote:
Originally Posted by PTrenholme View Post
Did you try the -Y option instead of the -X one? Since you're "root," the -X restrictions might not apply, but after the su you're no longer "root," eh?

Just a guess - I never use ssh on my one-person laptop.
thanks, but no, -Y does not help at all.
 
Old 11-17-2008, 08:25 PM   #4
mrclisdue
Senior Member
 
Registered: Dec 2005
Distribution: Slackware
Posts: 1,134

Rep: Reputation: 277Reputation: 277Reputation: 277
The default display for X-forwarding, as per sshd_config is :10.0, so that part of the error message is correct.

I'm puzzled as to why you don't/can't ssh as the user, rather than as root and then su'ing. I'm thinking that this may be the issue, since from the user's machine's standpoint, the :10.0 display is 'owned' by root, not by the user, thus the authentication issue.

These are just thoughts, and by no means an attempt at expertise....

cheers,
 
Old 11-17-2008, 08:26 PM   #5
BrianK
Senior Member
 
Registered: Mar 2002
Location: Los Angeles, CA
Distribution: Debian, Ubuntu
Posts: 1,334

Original Poster
Rep: Reputation: 51
I can't ssh as the user because I don't know their password & don't want to reset it every time an issue like this comes up.
 
Old 11-17-2008, 08:54 PM   #6
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,187

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
Again, I'm guessing here, but I just tried this:

Opened a terminal window in my current X session.
Did a su - to start a "root" login shell
Did a su -m Peter to go back to my user environment (without a password prompt)
Did a startx -- :1 to open a second X server for the user login.
Checked that I could switch between the :0 and :1 sessions with <ctrl><alt><F7> and <ctrl><alt><F8>
Logged out of the :1 session and cleaned up.

All that worked.

So, try starting a "root" X-server (which you said worked), do your su to the user, and then a startx -- :1 to start a second X-server for the user. (Perhaps you'll need a startx -- 10:1 per the comments above.)
 
Old 11-17-2008, 09:12 PM   #7
mrclisdue
Senior Member
 
Registered: Dec 2005
Distribution: Slackware
Posts: 1,134

Rep: Reputation: 277Reputation: 277Reputation: 277
Found this thread:

Code:
http://linux.derkeiler.com/Newsgroups/comp.os.linux.x/2003-10/0151.html
which has a number of similarities to what you're attempting to accomplish, with some thoughts about merging magic cookies, etc...

cheers,
 
Old 11-18-2008, 12:42 AM   #8
allend
LQ 5k Club
 
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware64-15.0
Posts: 6,371

Rep: Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750
I use ssh with the -Y option to log in as a normal user.
To use a GUI program with root privileges, I do 'kdesu <program name>'.
This works fine if you have kde installed as kdesu takes care of all the display stuff.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Lost path when su'ing to root from user GUI terminal arashi256 Linux - Newbie 4 01-08-2008 09:32 AM
SU'ing to user and getting ".bashrc permission denied" chris26 Slackware 7 11-23-2006 03:36 PM
Windows user thinks open source is crap tribalmasters General 33 09-16-2005 02:18 PM
unable to open apps when 'su'ing to root from user account ganja_guru Linux - Software 3 06-03-2005 10:51 AM
SU'ing Applications Through KDE Crashed_Again Linux - Software 3 06-05-2003 06:16 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 12:29 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration