Ubuntu Forums > The Ubuntu Forum Community > Other Community Discussions > Tutorials & Tips > HOWTO: Control the gnome VNC vino-server from the command line
PDA
View Full Version : HOWTO: Control the gnome VNC vino-server from the command line
srf21c
September 28th, 2006, 02:23 AM
CAVEAT: A user must already be logged into the desktop on the target machine for this to work
Here is a cool trick for remotely enabling the gnome vino VNC server (assuming that it's already been installed and configured) on a box that you only have SSH access to.
Log into the target system using SSH, and run the following command:
gconftool-2 -s -t bool /desktop/gnome/remote_access/enabled true
You can also monkey with the vino server options by editing this file
/home/<userhomedir>/.gconf/desktop/gnome/remote_access/%gconf.xml
Let's say you want to disable the "Ask you for confirmation" setting, or change the password.
Easiest way to do it:
1) On your own Ubuntu box; Go to System => Preferences => Remote Desktop. and configure the Remote Desktop Preferences to your liking, then click close.
2) Navigate to ~/.gconf/desktop/gnome/remote_access/ in your home directory, open up the %gconf.xml file, and copy the contents.
3) Establish an SSH connection to the remote box, change directory to /home/<userhomedir>/.gconf/desktop/gnome/remote_access/ directory, and backup the existing %gconf.xml file. mv %gconf.xml %gconf.xml.bak
4) Create a new %gconf.xml file, vi %gconf.xml then paste in the contents for your own %gconf.xml file that you copied in step number 2.
5) Stop and start the vino server from the command line
gconftool-2 -s -t bool /desktop/gnome/remote_access/enabled false
gconftool-2 -s -t bool /desktop/gnome/remote_access/enabled true
6) Connect to the target system using your vnc client. When I'm on my Ubuntu workstation, I prefer to connect securely via SSH with the following command
vncviewer -via username@somehost.com targetboxhostname:0
motin
October 1st, 2006, 09:13 PM
Very interesting. Although I am in the same situation I cannot really use your guide, since I am using Putty from Windows... Can you maybe add some comments on how to achieve the same stuff in my situation? In case you know of course...
srf21c
October 2nd, 2006, 09:35 PM
You are perfectable capable of setting each value in the /home/<userhomedir>/.gconf/desktop/gnome/remote_access/%gconf.xml file manually using the gconftool-2 command.
I was unable to dig up any documentation on proper syntax of the %gconf.xml file so I did not feel qualified on delving into this method in more detail on my original post.
If you examine an existing %gconf.xml file, and compare that to the gconftool-2 command syntax that I have already posted, you should be able to figure out how to set the other parameters.
motin
October 8th, 2006, 12:09 AM
I have come so far that the vino server asks me for a password. A password that I cannot remember at all.
The problem is that I cannot change it via CLI. It is not written in plain text in ~/.gconf/desktop/gnome/remote_access/%gconf.xml, so changing it to "qwerty" in the file doesn't help.
Also, the command:
gconftool-2 -s -t string /desktop/gnome/remote_access/vnc_password qwerty
Just does the same thing as changing the file manually - ie doesn't help.
Do you or someone else now in what hash-type the vino passwords are written in?
motin
October 8th, 2006, 01:14 AM
I started a new thread on the matter (generating the password): http://ubuntuforums.org/showthread.php?p=1592817
srf21c
October 9th, 2006, 09:20 PM
Don't know what the vino server hash-type is, but here's the string I get after setting the vino password to "qwerty"
<entry name="vnc_password" mtime="1160442984" type="string">
<stringvalue>cXdlcnR5</stringvalue>
</entry>
jdong
October 9th, 2006, 11:44 PM
Have you tried an htpasswd hash in there?
morton2002
October 13th, 2006, 12:11 PM
Many more details are available in the spun-off password thread (http://ubuntuforums.org/showpost.php?p=1613152&postcount=2). Thanks for your head-start on this, I found the posts very useful and I hope I've helped you too.
srf21c
October 13th, 2006, 05:19 PM
I found a workaround that allows for logging in a user to the desktop remotely, simply edit the gnome desktop preferences to enable autologin, then reboot the box.
Edit the /etc/gdm/gdm.conf-custom file using your favorite text editor, and under the daemon section add the following lines
[daemon]
AutomaticLogin=<username>
AutomaticLoginEnable=true
Then reboot the box and the user will automatically be logged into the desktop on the next boot, thus starting the gnome vino vnc server (if enabled)
frafu
October 14th, 2006, 09:42 AM
@srf21c
I suppose the settings in /etc/gdm/gdm.conf-custom override those in /etc/gdm/gdm.conf
However, there is another question that I am wondering about: how can I enable the vino vnc server for the next boot on a system that is not running. (the disk with the system that does not run being mounted on another system)
Thanks in advance for your help.
frafu
Background:
I have a headless celeronbox with 2 ubuntu dapper systems on it; both systems have remote logins enabled (vino, nx, openssh). I would like to upgrade the second ubuntu to edgy, but I don't know whether the upgrade will disable the remote logins.
Consequently, I thought to edit menu.lst in grub to make it reboot after the upgrade with the system that has not been upgraded and reenable the remote logins from the new edgy before booting into edgy.
frafu
October 15th, 2006, 04:49 PM
I did the upgrade this afternoon and the update manager asked me several times whether I wanted to keep a specific old configuration file from dapper instead of installing the new one. As I kept the old configuration file for the remote desktop (and few others), I was able to connect with my vnc client at once after booting to edgy.
frafu
srf21c
October 16th, 2006, 04:54 PM
Excellent! In answer to your question, I think the bottom line is this; If you want the vino server to start hands-free after a reboot, you need to have automatic login to the desktop enabled.
bobpaul
March 19th, 2007, 04:35 PM
I know it's digging up an old thread, but one could install a windows xserver (cygwin has one, or Xming is good) and enable X forwarding in putty. It's even easier if your local machine is also linux:
$ ssh -XC user@host
Then you could open vino-preferences remotely. vino-preferences is a simple enough GUI that even across a pretty slow connection it still responds decently.
EDIT: I meant uppercase C for compression. Good for slower speed connections. Lowercase c will cause an error. Sorry. Thanks to srfc21 for pointing that out.
srf21c
March 19th, 2007, 07:34 PM
Bob,
_great_ suggestion....much more elegant than my approach. Thanks for adding that to the thread.
Btw, have you tested it succesfully?
bobpaul
March 21st, 2007, 03:45 PM
Yeah, I use Xming and putty's X-Forwarding optional from my WinXP machine at work to access my home machine all the time! Errm, I mean... I only do work related things at work. :-\"
Bigger apps, like firefox, are pretty unresponsive, but small config windows like this work just fine. For reference, I have 128kbps upstream on my home connection. I think your command line solution would be the best method over something like dialup as it might take a few minutes for the dialog to "stabilize" on a really slow connection like that.
frafu
March 21st, 2007, 04:22 PM
To open the "Login Window" preferences, you have to type into the terminal after opening your ssh -Y connection:
sudo gdmsetup
To open the "Remote Desktop" preferences, you have to type into the terminal:
sudo vino-preferences
But, the changes made in the forwarded preferences seem not to be effective in the session created by the auto-login at startup.
srf21c
March 27th, 2007, 03:37 PM
$ ssh -Xc user@host
Bob, I think the original command example you gave above might have a typo.
The lowercase -c option specifies the cipher to use, whereas the uppercase -C option enables compression. Did you mean to use the uppercase -C to enable compression? like this:
ssh -XC user@host
FXFman1209
June 6th, 2007, 10:43 AM
Hmm. I know this is an old thread, but... does this work? I don't think you should use sudo with vino-preferences, because your vino preferences are per-user. If you use sudo vino-preferences, it would set the preferences for root, and not the user.
Therefore I propose that you login as the user you want to desktop control, and then just simply do vino-preferences.
However, I could be totally wrong, however it works fine for me. Thanks for the -X suggestion, i never even thought of doing that. :-P
theQmaster
June 17th, 2007, 02:42 AM
I have Dapper without keyboard and monitor and I need to connect the desktop to upgrade to Edgy. Remote access seems to be the only options thus far... I have access to a sh session thru putty.
I managed to start x, vino and gdm - when I connect to the box with VNC client it looks like it's connecting but the client doesn't display any window - it looks that in background... If I kill the vino server I get the windows that the connection has been disconnected....
What's wrong ? It looks that the server awaits for acceptance from the server but I don't get any window since I'm in sh, I only get a broadcast that a connection has been established
Any help?
theQmaster
June 17th, 2007, 03:01 AM
Just realised that my vino server is not starting anymore
mc@gsi:/tmp$ sudo /usr/lib/vino/vino-server
(vino-server:31773): Gtk-WARNING **: cannot open display:
Any good tips ?
frafu
June 17th, 2007, 10:03 AM
Do you have an X server running on your local machine? If so, try to connect through sh with the following command:
ssh -Y loginname@remotecomputerip
Because of the -Y option, the gui of the application started on your remote computer should be displayed on your local machine if there is a X server running on your local machine.
Particularly, you should be able to start the synaptic Package Manager and reinstall vino. Afterwards, you should start "vino-preferences" from the shell which should display the gui of the preferences on your local machine. There you should be able to enable vino (=vnc server of the remote machine)
Have a nice day.
theQmaster
June 17th, 2007, 01:21 PM
I my windows' putty I typed the command by I get
ssh: connect to host localhost port 22: Connection refused
Do you have an X server running on your local machine? If so, try to connect through sh with the following command:
ssh -Y loginname@remotecomputerip
Because of the -Y option, the gui of the application started on your remote computer should be displayed on your local machine if there is a X server running on your local machine.
Particularly, you should be able to start the synaptic Package Manager and reinstall vino. Afterwards, you should start "vino-preferences" from the shell which should display the gui of the preferences on your local machine. There you should be able to enable vino (=vnc server of the remote machine)
Have a nice day.
frafu
June 17th, 2007, 03:03 PM
Is there an ssh-server running on your remote computer? (If I remember correctly, the ssh-client gets installed by the default ubuntu installation, but the ssh-server is not.) I thought that the ssh server was running on your remote computer...
Do you have some way to access the remote computer with some shell? If so, you could use the command
sudo apt-get install openssh-server
to install the ssh-server.
Unfortunately, I don't have much knowledge about this things.
foxmajik
July 10th, 2008, 03:10 PM
gconftool-2 -s -t bool /desktop/gnome/remote_access/enabled trueThis doesn't actually stop or start the server, it just enables or disables the item in the configuration file.
$ gconftool-2 -s -t bool /desktop/gnome/remote_access/enabled true
jpruitt@winkypop:~$ nmap localhost
Starting Nmap 4.53 ( http://insecure.org ) at 2008-07-10 15:09 EDT
Interesting ports on localhost (127.0.0.1):
Not shown: 1712 closed ports
PORT STATE SERVICE
22/tcp open ssh
631/tcp open ipp
Nmap done: 1 IP address (1 host up) scanned in 0.069 secondsThe vino binary lives here:
/usr/lib/vino/vino-server
I discovered this while researching after my vino server crashed when I tried to set rotation to normal in the resolution preferences dialog.
Unfortunately starting the server from the command line doesn't seem to make it read the configuration stored in your home directory, and since there's no documentation available I don't know which switches to use to make it read the config, nor do I know what the switches are to specify them on the command line.
$ 10/07/2008 03:18:19 PM Autoprobing TCP port
10/07/2008 03:18:19 PM Autoprobing selected port 5900
10/07/2008 03:18:19 PM Advertising security type: 'TLS' (18)
10/07/2008 03:18:19 PM Advertising authentication type: 'VNC Authentication' (2)
10/07/2008 03:18:19 PM Advertising security type: 'VNC Authentication' (2)
jpruitt@winkypop:~$ nmap localhost
Starting Nmap 4.53 ( http://insecure.org ) at 2008-07-10 15:20 EDT
10/07/2008 03:20:48 PM Got connection from client localhost
10/07/2008 03:20:48 PM other clients:
Interesting ports on localhost (127.0.0.1):
Not shown: 1711 closed ports
PORT STATE SERVICE
22/tcp open ssh
631/tcp open ipp
5900/tcp open vnc
Nmap done: 1 IP address (1 host up) scanned in 0.070 seconds
Unfortunately there is no man page for vino-server.
srf21c
September 24th, 2008, 01:18 AM
Documentation for the vino-server seems hard to come by, indeed.
One option would be to configure a user to automatically log into the desktop on startup, then restart the machine. That should get the vino server running again, without having to get some hands on the physical console.
foxmajik
September 24th, 2008, 07:43 AM
Documentation for the vino-server seems hard to come by, indeed.
One option would be to configure a user to automatically log into the desktop on startup, then restart the machine. That should get the vino server running again, without having to get some hands on the physical console.
Yes and then anyone who walked by the computer could drop in and delete your / directory, view all of your private documents, impersonate you on the Internet and all sorts of other fun things. I wish more people would do this.
raindog469
March 25th, 2009, 11:37 AM
Sorry to bump an old thread, but we have three desktops with wired connections, one running Hardy and the other two Intrepid, and vino-server works fine on them. But we also have a laptop running Intrepid, and even with automatic login enabled and remote desktop enabled, the server just never runs unless we run /usr/lib/vino/vino-server manually.
We think this is because the wireless card doesn't get initialized until after the user has automatically been logged in, creating a race condition where vino-server is trying to get an IP address that may or may not exist. But the gconftool commands also don't seem to cause vino-server to run.
Anyone have any ideas about this? I'm just about to install x11vnc and make a script to run it remotely like I used to have to do under Mandriva, but just using Vino would be more convenient.
Yes and then anyone who walked by the computer could drop in and delete your / directory, view all of your private documents, impersonate you on the Internet and all sorts of other fun things. I wish more people would do this.
I'm sure glad I don't live in a group home.
MidSpeck
April 16th, 2009, 06:02 PM
It's nice that all the information needed is practically linked to from this thread. However, I'm the sort of guy that likes it all in one spot.
Turn on Ubuntu's built-in VNC server when all you have is SSH: (may have to have the user logged on to the desktop already, I haven't looked into that part of things at all)
gconftool-2 -s -t bool /desktop/gnome/remote_access/enabled true
gconftool-2 -s -t bool /desktop/gnome/remote_access/vnc_password cXdlcnR5
gconftool-2 -s -t list --list-type string
/desktop/gnome/remote_access/authentication_methods '[vnc]'
gconftool-2 --type bool --set /desktop/gnome/remote_access/prompt_enabled 0
Make an SSH tunnel to port 5900 and use a VNC viewer to connect.
Note that when you set the vnc_password, it expects it to be base64 encoded. So you'll be able to tell that my VNC password above is simply "qwerty". There are plenty of online base64 encoders and decoders to help you generate your own password.
srf21c
May 4th, 2009, 05:23 PM
Thanks for consolidating the info into a single post. Good idea.
neo-man
May 5th, 2009, 02:13 AM
I can't understand how can I use .htpasswd? anyhow Nice tutorial.
Debian (http://www.linux-archive.org/debian-user/)
vBulletin® v3.8.1, Copyright ©2000-2009, Jelsoft Enterprises Ltd.