LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices

Reply
 
LinkBack Search this Thread
Old 01-19-2009, 10:39 AM   #1
cheeken
LQ Newbie
 
Registered: Jan 2009
Posts: 1

Rep: Reputation: 0
[Ubuntu] Spawning graphical apps on desktop via remote shell


I would like to remotely ssh into my Ubuntu box and run applications which require a display (a la gedit) through my ssh console and have those applications spawn on the Ubuntu desktop (not on the machine I am ssh'ing from).

I have achieved success in doing this on Redhad and SLED (running Xvnc) by assigning the DISPLAY environment variable to the appropriate value (:0.0, for example). However, Ubuntu presents other difficulties (it uses vino/gnome, not Xvnc) which seem to be tied to xauth.

After setting DISPLAY and issuing a command like gedit, I am returned the following error. (On my Redhat and SLED systems, simply setting DISPLAY to the appropriate value is all I have to do.)

Code:
myuser@myhost:~$ gedit
Invalid MIT-MAGIC-COOKIE-1 keycannot open display:
Run 'gedit --help' to see a full list of available command line options.
If I peek at my desktop's environment - specifically the XAUTHORITY variable - and apply that same value to my shell session, the command runs without errors and the gedit window spawns on the desktop. But is there a way to figure out the value of XAUTHORITY without looking at my desktop session? Moreover, is there a better approach to this problem than trying to set DISPLAY and XAUTHORITY to the appropriate values?

Any thoughts are greatly appreciated. Thanks!
 
Old 02-04-2009, 01:24 AM   #2
CITguy
LQ Newbie
 
Registered: Apr 2006
Location: Indianapolis
Distribution: Ubuntu Hardy Heron (8.04) Server & Desktop
Posts: 14

Rep: Reputation: 0
SSH?

Have you tried using the command ssh rather than using vnc? There is an "-X" option that allows you to redirect X to the local machine.

SYNTAX:
Code:
ssh <user>@<machine name or IP address> -X
EXAMPLE:
If I (foo) wanted to ssh into my desktop (Achilles: 192.168.1.20), I would use one of the following commands:
Code:
foo@localhost:~$ ssh foo@Achilles -X
or
foo@localhost:~$ ssh foo@192.168.1.20 -X
Then, once I'm connected to Achilles, I run the "gedit" command to open the application on my local machine.
Code:
foo@Achilles:~$ gedit
 
Old 02-04-2009, 01:27 AM   #3
jschiwal
Moderator
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,262

Rep: Reputation: 561Reputation: 561Reputation: 561Reputation: 561Reputation: 561Reputation: 561
Is your local terminal on a Linux or windows machine. If you run "ssh -X" from Linux, ssh will handle xauth and the DISPLAY name for you. If you are using windows you can install Cygwin/X and use ssh the same way.
 
Old 02-04-2009, 01:47 AM   #4
CITguy
LQ Newbie
 
Registered: Apr 2006
Location: Indianapolis
Distribution: Ubuntu Hardy Heron (8.04) Server & Desktop
Posts: 14

Rep: Reputation: 0
In my instructions, I am referring to the local machine as a Linux box.
As far as Windows goes, I am not familiar with opening X apps locally.
 
Old 02-04-2009, 03:23 AM   #5
blackhole54
Senior Member
 
Registered: Mar 2006
Posts: 1,896

Rep: Reputation: 60
Uh, the OP wants to open the application on the remote machine, not on the local machine:

Quote:
Originally Posted by cheeken View Post
... and have those applications spawn on the Ubuntu desktop (not on the machine I am ssh'ing from).
On my (older) Ubuntu system, $XAUTHORITY just points to the ~/.Xauthority file. Are you saying on yours it contains the actual value of the cookie and there is no ~/.Xauthority file? If so, I think you could have a script write that value to a file when you graphically log in to your Ubuntu box. (Make sure you think about security implications. And certainly make sure such a file is readable only by the user.) Then you can read that file and set the variable when ssh in. In Gnome you can set the script which writes the file to run from:

System ->Preferences -> Sessions -> Startup Programs

Last edited by blackhole54; 02-04-2009 at 03:27 AM. Reason: typo
 
Old 02-04-2009, 05:00 AM   #6
jschiwal
Moderator
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,262

Rep: Reputation: 561Reputation: 561Reputation: 561Reputation: 561Reputation: 561Reputation: 561
What use is a graphical program running remotely if you can't control it?
If that is truly what you want, then you can precede the command with DISPLAY=':0.0'. Example:
DISPLAY=':0.0' gedit
 
  


Reply

Tags
ssh, ubuntu, vino, xauth, xvnc


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to login to graphical remote desktop in linux sawaby Linux - Newbie 4 06-12-2008 11:37 AM
LXer: Two Linux remote desktop apps freed from their commercial ... LXer Syndicated Linux News 1 09-05-2006 11:01 AM
Keeping remote desktop apps active after logout? stefaandk Linux - General 1 05-31-2006 07:47 PM
How to run Graphical commands in remote Desktop. rktech83 Linux - Networking 7 03-09-2006 07:11 AM
from shell to KDE or any graphical desktop ngan_yine Linux - Newbie 8 09-05-2003 05:59 PM


All times are GMT -5. The time now is 02:41 PM.

Main Menu
 
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
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration