LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-05-2009, 09:14 PM   #1
Lye
LQ Newbie
 
Registered: Aug 2009
Posts: 4

Rep: Reputation: 0
Question Logging in as if you were at the computer...


Here is my issue in short. I am looking to run a Java program which uses the Swing libraries and therefor requires a connection to X server. The trick is that I'm trying to run this programming through SSH.

I have tried using Xvfb(X Virtual Frame Buffer) to run my program however it simply doesn't work in Xvfb(seems to work but doesn't produce the output I'm looking for).

If I log into the server using the Grub login interface(what you would normally see at system boot up) and then instead of logging out I "Switch User", my program runs successfully through SSH. In SSH I set the DISPLAY(:0.0) which was initiated(authenticated??) from my Grub session and the program runs just as expected.

I suspect it might have something to do with my xauth cookie but I can't seem to grasp the concept from documents around the web.

I should note that the error I get when trying to use DISPLAY :0.0 from SSH when completely logged out is:

Quote:
No protocol specified
java.lang.InternalError: Can't connect to X11 window server using ':0.0' as the value of the DISPLAY variable.
My question is: How can I simulate(or initiate) the action of logging into the computer as if you were in front of the screen and then "Switching Users"?

Thanks in advance.

My system is:
Ubuntu Server 9.04
Linux version 2.6.28-14-server

Last edited by Lye; 08-05-2009 at 09:21 PM.
 
Old 08-05-2009, 09:25 PM   #2
forrestt
Senior Member
 
Registered: Mar 2004
Location: Cary, NC, USA
Distribution: Fedora, Kubuntu, RedHat, CentOS, SuSe
Posts: 1,288

Rep: Reputation: 99
What you are trying to do should "just work" if you run 'ssh -X servername' from another system running X. If you are trying to do this from a Windows system, you will need to install an X server (search for cygwin on Google) to get it to work. As far as "Grub login interface" goes, this is a completely nonsensical expression. I have no idea what you are talking about, and I'd wager nobody else does either. I'm guessing you mean you are logging into the command-line interface (or CLI), but I'm only guessing. I also have no idea what you mean by "switching users" from a CLI perspective however. I'd love to help you, but I'll need clarification and more details.

Let us know,

Forrestt

p.s. after your edit, there is a bit more clarity, however not totally sure. Try running "ssh -X servername" and then don't do anything to your DISPLAY variable, but just run your app.

Last edited by forrestt; 08-05-2009 at 09:28 PM.
 
Old 08-05-2009, 11:00 PM   #3
Lye
LQ Newbie
 
Registered: Aug 2009
Posts: 4

Original Poster
Rep: Reputation: 0
forrestt, that's for your reply. I guess I forgot to mention that I'm trying to get this to run without X on the client side. It will be run from a PHP script that connects to the server through SSH. PHP doesn't run X so I need this to run completely separate from X on the Client even though the program requires it. This is where Xvfb came in.

Think of it this way. 2 computers total. 1 computer without X connecting through SSH(call it Client) and the physical screen attached to the server(call it Server). Here are the steps to get it to work:
1. Log into the Server from the physical screen.
2. Log into the Server from the Client.
3. Set DISPLAY to :0.0 from the Client.
4. Run the Java program from the Client.

I guess noting that I "Switched Users" on the Server from the physical screen in the Grub environment was unnecessary. The point was that I can't completely log off the Grub environment.

The way it does NOT work:
1. Log into the Server from the physical screen.
2. Log into the Server from the Client.
3. Log OFF the Server from the physical screen.
4. Set DISPLAY to :0.0 from the Client.
5. Run the Java program from the Client.

Using these 5 steps produces the error I quoted in my post.

Sorry for the confusion.
 
Old 08-05-2009, 11:26 PM   #4
forrestt
Senior Member
 
Registered: Mar 2004
Location: Cary, NC, USA
Distribution: Fedora, Kubuntu, RedHat, CentOS, SuSe
Posts: 1,288

Rep: Reputation: 99
OK, I think I understand what you are saying now. I also think you understand what the problem is. The confusion I was having is based on the terminology you are using. Perhaps you don't mean Grub but rather the Gnome environment? Anyway, yes, you have to have an active X session in order to open a window. I'm not familiar with any way to achieve this without Xvfb or having a system that boots into an active X session without needing to log in. Do you really have to get the info you are looking for from a GUI, or are you just doing that because you know that it works? Perhaps if you tell us the info you are looking for, we can give you an alternative way to get the same info without running a GUI app.

Forrest
 
Old 08-06-2009, 11:28 AM   #5
Lye
LQ Newbie
 
Registered: Aug 2009
Posts: 4

Original Poster
Rep: Reputation: 0
Thanks again forrestt, I appreciate your help. Indeed I did mean Gnome. Sorry about that.

I'm porting a macro script written for the program ImageJ to perform convolution on an image and create a matrix of image representing the view of scanning electron microscopes. Not easy to find the software to do this. Luckily the person who programmed the macro did it within software that can be run from the command line. However, ImageJ has been known to have issues with running headless. Even though they provide the option to run "headless" the libraries for their GUI are still evoked. Bummer.
 
Old 08-07-2009, 05:04 PM   #6
pengrath
LQ Newbie
 
Registered: Feb 2009
Distribution: Arch
Posts: 13

Rep: Reputation: 0
You may be able to achieve this by running an X Windows Server locally
the free one for Windows that I know of is Xming (google it)

forrestt was right about ssh -X (or you can get the same effect in putty by changing some settings)
However not every server is set up for this, you may need to edit /etc/ssh/ssh_config
and add 'ForwardX11 yes' to the list and restart the sshd.

forrestt was also right in saying when you login using ssh -X
do NOT replace the Display variable!
it gets set differently then if you login from the physical screen, even if the physical screen is not logged in to an X session

sorry if this did not help
Good Luck
 
Old 08-07-2009, 05:28 PM   #7
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,186

Rep: Reputation: 346Reputation: 346Reputation: 346Reputation: 346
Just a thought - never tried this - but look at the various CLI browser implementations to see how they manage a display without an X-server. Also, I think I recall a thread a couple of months ago about a CLI X-sever as well.
 
Old 08-11-2009, 01:23 PM   #8
Lye
LQ Newbie
 
Registered: Aug 2009
Posts: 4

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by pengrath View Post
You may be able to achieve this by running an X Windows Server locally
the free one for Windows that I know of is Xming (google it)

forrestt was right about ssh -X (or you can get the same effect in putty by changing some settings)
However not every server is set up for this, you may need to edit /etc/ssh/ssh_config
and add 'ForwardX11 yes' to the list and restart the sshd.

forrestt was also right in saying when you login using ssh -X
do NOT replace the Display variable!
it gets set differently then if you login from the physical screen, even if the physical screen is not logged in to an X session

sorry if this did not help
Good Luck
Thanks for your reply. I think you're missing the goal however. Windows and Xming can not be involved. The connection to the server is being made with PHP. As far as I know there is no X Windows implementation for PHP.
 
Old 08-11-2009, 02:36 PM   #9
pengrath
LQ Newbie
 
Registered: Feb 2009
Distribution: Arch
Posts: 13

Rep: Reputation: 0
Got it now, sorry misunderstood the problem.
 
  


Reply

Tags
login


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
KDE jams my computer after logging out. ComputerMan Slackware 6 01-27-2008 02:26 AM
logging file accesses on a shared computer cryo70 Linux - General 5 10-16-2005 10:58 AM
DHCP Problem when logging on to computer Brian.Boyle Linux - Networking 1 11-05-2003 09:41 AM
DHCP Problem when logging on to computer Brian.Boyle Linux - Networking 1 11-04-2003 08:27 PM
using red-carpet without logging out and logging as root. packman Linux - Software 1 12-09-2002 03:55 AM


All times are GMT -5. The time now is 02:31 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration