Ubuntu Forums ubuntu.com - launchpad.net - ubuntu help  

Go Back   Ubuntu Forums > The Ubuntu Forum Community > Other Community Discussions > Tutorials & Tips
Register Reset Password Forum Help Forum Council Search Today's Posts Mark Forums Read

Tutorials & Tips
The place to find Ubuntu related Tips & Tricks.

 
Thread Tools Display Modes
Old March 3rd, 2010   #41
doobiest
A Carafe of Ubuntu
 
Join Date: Apr 2007
Beans: 140
Re: HOWTO: Control the gnome VNC vino-server from the command line

Quote:
Originally Posted by InkyDinky View Post
For those that stumble upon this thread trying to start vino from the cli via a remote ssh connection look here: http://ubuntuforums.org/showthread.php?t=1017746
at post #7
Code:
1. ssh to that machine and authenticate as x
2. sudo -s to become root
3. export DISPLAY=:0.0
4. xhost +
5. exit from root shell using exit
6. export DISPLAY=:0.0
7. start vino-server using /usr/lib/vino/vino-server
There may be another way but this saved my bacon after the Karmic upgrade when I needed to get my desktop and vino wasn't started.
This worked perfectly for me, and really only 6 & 7 are needed.

6. export DISPLAY=:0.0
7. start vino-server using /usr/lib/vino/vino-server

I would a & actually, so /usr/lib/vino-server &

If this happens often you could create a script like I did

sudo vi /usr/local/bin/restart_vnc

insert these two lines

export DISPLAY=:0.0
/usr/lib/vino/vino-server &

save (:wq)

sudo chmod +x /usr/local/bin/restart_vnc


Also the gconf tips here dont work. I'm sure that toggles the config options but doesnt restart a crashed server.

Also I've experienced that SSH -X or -Y and issuing vino-preferences doesnt work. What is actually does it spawn a vino server on the client machine (if linux i guess) so when you vnc through your ssh tunnel it just loops back to your clients desktop.
__________________
I've tried nothing and I'm all out of ideas!

Last edited by doobiest; March 3rd, 2010 at 04:06 PM..
doobiest is offline   Reply With Quote
Old March 3rd, 2010   #42
bobpaul
Gee! These Aren't Roasted!
 
Join Date: Feb 2006
Location: North Dakota
Beans: 209
Ubuntu 9.10 Karmic Koala
Re: HOWTO: Control the gnome VNC vino-server from the command line

Quote:
Originally Posted by doobiest View Post
Also I've experienced that SSH -X or -Y and issuing vino-preferences doesnt work. What is actually does it spawn a vino server on the client machine (if linux i guess) so when you vnc through your ssh tunnel it just loops back to your clients desktop.
If you ssh in and execute vino-preferences, it's running on the remote machine; only the UI is forwarded to the local X11 server. vino-preferences running in this way does not have access to the files/services on the local machine anymore than it would if you were sitting at the remote machines keyboard and running vino-preferences there. If vino-server was running on your local machine, it's either because it was already running or you ran vino-preferences on the local machine instead of the remote host.

You stated "so when you vnc through your ssh tunnel"... How did you have your port tunnel (-L) setup? My guess is you connected to the local vnc server on localhost directly instead of connecting to the ssh client's port tunnel. It didn't loop back... it never even left your machine.
__________________
Search first, ask questions later!
From Thread Tools, "Mark this thread as solved" if your problem's been solved.
bobpaul is offline   Reply With Quote
Old March 3rd, 2010   #43
doobiest
A Carafe of Ubuntu
 
Join Date: Apr 2007
Beans: 140
Re: HOWTO: Control the gnome VNC vino-server from the command line

#ssh -X destination
#vino-preferences
*close vino-preferences
#ps aux|grep vino (shows the server running now)
#vncviewer -via destination localhost (executed locally, not in the ssh session)

This redirected me to my local vncsession, not the remote one. And No I have verified that the vino-server is not running locally on my client

It's completely reproducable I jsut did it right now again. It does run vino-server on the remote computer but it's attached to my local X display, not the remote one. If I close the ssh connection, then of course it stops vncing to my local session and doesnt vnc to the remote session either. The processing for the service might be occuring remotely but the routing is still going local.
__________________
I've tried nothing and I'm all out of ideas!

Last edited by doobiest; March 3rd, 2010 at 04:28 PM..
doobiest is offline   Reply With Quote
Old March 3rd, 2010   #44
doobiest
A Carafe of Ubuntu
 
Join Date: Apr 2007
Beans: 140
Re: HOWTO: Control the gnome VNC vino-server from the command line

There's no level of technical accuracy here but this should describe what is happening.

[vncviewer]-->[ssh tunnel]-->[remote vnc server]
[local X ]<--[ssh tunnel]<--[remote vnc server]
[local X ]-->[ssh tunnel]-->[remote vnc server]
[vncviewer]<--[ssh tunnel]<--[remote vnc server]

(Following the arrows, read some lines left to right and some lines right to left)

ps aux|grep vino-server on Local box = NO
ps aux|grep vino-server on Remote box = YES

Are we certain that X11 Forwarding ISNT bi-directional? It sure seems that way to me.
__________________
I've tried nothing and I'm all out of ideas!

Last edited by doobiest; March 3rd, 2010 at 04:46 PM..
doobiest is offline   Reply With Quote
Old April 8th, 2010   #45
tormod
Ubuntu Extra Shot
 
Join Date: Feb 2005
Beans: 354
Re: HOWTO: Control the gnome VNC vino-server from the command line

Yes, doobiest is right, just running vino-preferences over an X11-forwarding ssh session might start a vino-server controlling the local (to you) display. This was also mentioned here http://ubuntuforums.org/showpost.php...67&postcount=4

You can verify which X server (display) the vino-server is controlling with:
Code:
cat /proc/`pgrep vino-server`/environ | tr '\0' '\n'|grep DISPLAY
If it shows DISPLAY=:0.0 it is the local display on the remote machine, thus the remote screen (which you most likely want to access). If it shows for instance DISPLAY=localhost:10.0 it is tunneling back through your X11-forwarding ssh connection and thus to your local screen and you get a loop.

The use of dbus-launch lets vino-server be started by the dbus server running in the remote session, so that it connects to the display of that session.
__________________
Please use launchpad to search for/report bugs and problems: https://help.ubuntu.com/community/ReportingBugs
tormod is offline   Reply With Quote
Old April 8th, 2010   #46
tormod
Ubuntu Extra Shot
 
Join Date: Feb 2005
Beans: 354
Re: HOWTO: Control the gnome VNC vino-server from the command line

So here is how to make this work (tested on Ubuntu 9.10):
Connect with ssh -X to your remote machine. Find the dbus address of the processes in the desktop session running "locally" on the remote machine, for instance the nautilus process:
Code:
cat /proc/`pgrep nautilus`/environ | tr '\0' '\n' | grep DBUS
Now start vino-preferences on the remote machine but set the DBUS address which you found above:
Code:
DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-blahblah... vino-preferences
You can now run vinagre on your local machine.

On the other hand, the use of dbus-launch with gconftool-2 makes vinagre start on the right display, however the changes made in the vino-preferences GUI are not applied to the started server. At least that was what happened here, where I ended up with a bunch of dbus and gconf servers running. Even if I turned off the "You must confirm each access to this machine" in the GUI, this option stayed on for the started vino-server, so I could not connect to the unattended machine.
__________________
Please use launchpad to search for/report bugs and problems: https://help.ubuntu.com/community/ReportingBugs
tormod is offline   Reply With Quote
Old April 8th, 2010   #47
doobiest
A Carafe of Ubuntu
 
Join Date: Apr 2007
Beans: 140
Re: HOWTO: Control the gnome VNC vino-server from the command line

Thanks thats actually very helpful. I need to take a deeper look at that.

I'll post this again, because I think what you posted may be too complicated for some users who don't have the background knowledge in this area.

Making a script like is worked great for me. I usually find vino crashes (inconsistently) when I'm using the clipboard. I can run vnc_restart from ssh easily to gain access again.

doobiest@LinuxBox:/usr/local/bin$ cat vnc_restart
export DISPLAY=:0.0
/usr/lib/vino/vino-server &
__________________
I've tried nothing and I'm all out of ideas!
doobiest is offline   Reply With Quote

Bookmarks

Thread Tools
Display Modes

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

Forum Jump


All times are GMT -4. The time now is 01:30 PM.


vBulletin ©2000 - 2010, Jelsoft Enterprises Ltd. Ubuntu Logo, Ubuntu and Canonical © Canonical Ltd. Tango Icons © Tango Desktop Project. bilberry