66

I have one computer running Ubuntu 10.04, and is running Vino, the default VNC server.

I have a second Windows box which is running a VNC client, but does not have any X11 capabilities. I am ssh'd into the Ubuntu host from the Windows host, but I forgot to enable VNC access on the Ubuntu host.

On the Ubuntu host, is there a way for me to enable VNC connections from the Ubuntu commandline?

Update:

As @koanhead says below, there is no man page for vino (e.g. man -k vino and info vino return nothing), and vino --help doesn't show any help).

10 Answers 10

25

Just running

/usr/lib/vino/vino-server

should do the job.

Once you have access to your server, I would recommend that you add it to Autostarted Apps so it is always started.

You'll probably like change some settings with :

vino-preferences

be very careful when you run vino-preference on a remote machine, if you uncheck "Allow other users to control your desktop", you won't be able to check it back.

or to edit :

~/.gconf/desktop/gnome/remote_access/%gconf.xml

Here a sample file :

<?xml version="1.0"?>
<gconf>
    <entry name="vnc_password" mtime="1289267042" type="string">
        <stringvalue>cXdlcnR5</stringvalue>
    </entry>
    <entry name="view_only" mtime="1289262982" type="bool" value="false"/>
    <entry name="prompt_enabled" mtime="1254965869" type="bool" value="false"/>
    <entry name="authentication_methods" mtime="1289267034" type="list" ltype="string">
        <li type="string">
            <stringvalue>vnc</stringvalue>
        </li>
    </entry>
    <entry name="enabled" mtime="1289263574" type="bool" value="true"/>
</gconf>

Be careful, the password is base64 encoded. For this file, the password is qwerty. I see on some forum that people have change it successfully, but I had issue with it.

Here an online base64 encoder :

http://www.motobit.com/util/base64-decoder-encoder.asp

  • 6
    I got the following error when executing /usr/lib/vino/vino-server: No protocol specified ** (vino-server:2040): WARNING **: Could not open X display – Tuan Anh Hoang-Vu Oct 22 '12 at 23:01
  • @hvtuananh Do you have a display you can share? Do you have the evd variable DISPLAY set accordingly? My answer assume that you already have a display starting by default, but you don't have string and use the command line to make it available. – Guillaume Coté Dec 4 '12 at 1:30
  • 1
    This does not work in (at least) 13.10. See answer by ouzmoutous below instead. – Emil Styrke Jan 27 '14 at 11:26
  • If someone has problems, notice the bug: bugs.launchpad.net/ubuntu/+source/vino/+bug/1607663 . – Rmano Apr 5 '17 at 21:32
  • 3
    vino-preferences: command not found – endolith Dec 10 '18 at 3:31
28

Short Answer:

gconftool-2 --set --type=bool /desktop/gnome/remote_access/enabled true

as the accepted answer mentions, if vino isn't started on the remote machine, use

/usr/lib/vino/vino-server

Long Answer and more info:

A subset of the settings for the current built-in remote access server (vino) can be seen, as mentioned, from vino-preferences. A complete list of gconf flags can be seen with the gconf-editor command, listed under /desktop/gnome/remote_access . You can see also the other remote_access keys with this command (or a variation on it):

gconftool-2 -a /desktop/gnome/remote_access

(For whatever reason, -R will also work.)

You can also get the schema key documentation via the --long-docs arg.

E.g., for the alternative_port key :

gconftool-2 --long-docs /desktop/gnome/remote_access/alternative_port

       The port which the server will listen to if the
       'use_alternative_port' key is set to true.
       Valid values are in the range from 5000 to 50000.

So, for example, here's how to change default port via command line:

gconftool-2 --set --type=bool /desktop/gnome/remote_access/use_alternative_port true
gconftool-2 --set --type=int /desktop/gnome/remote_access/alternative_port 5999

gconftool will give you the keys under a given directory. Here is the 'remote_access' section:

gconftool-2 -a /desktop/gnome/remote_access
 use_upnp = false
 vnc_password = 
 authentication_methods = [vnc]
 network_interface = 
 require_encryption = false
 disable_background = false
 enabled = true
 use_alternative_port = false
 mailto = 
 disable_xdamage = false
 lock_screen_on_disconnect = false
 icon_visibility = always
 view_only = false
 prompt_enabled = true
 alternative_port = 5900

Here is how to list all the schema docs under /desk/gnome/remote/access (via command-line /bin/bash):

for key in ` gconftool-2 -a /desktop/gnome/remote_access | awk '{print $1}'  ` ; do echo $key ; gconftool-2 --long-docs /desktop/gnome/remote_access/$key ; done
  • /usr/lib/vino/vino-server doesn't work from SSH, it says Cannot open display: – endolith Dec 10 '18 at 3:32
24

I also wanted to enable vino with the command line without going in vino-preferences.

When I started /usr/lib/vino/vino-server, it says that I didn't have desktop sharing service enabled.

With Unity gconftool isn't usable anymore. We have to do it via gsettings.

So, first, enable vino :

gsettings set org.gnome.Vino prompt-enabled true

Then start vino :

/usr/lib/vino/vino-server

Now you can access remotely to your computer.

If you want to see all configs available for Vino :

gsettings list-keys org.gnome.Vino
  • 2
    To do this over SSH or from a text-mode terminal where the DISPLAY environment variable isn't sett, you need to prepend DISPLAY=:0 to the set command, otherwise you will get "failed to commit changes to dconf". – Emil Styrke Jan 27 '14 at 11:25
  • So in addition to the above I had to export DBUS_SESSION_BUS_ADDRESS=.... To get this variable value I copied from a running process' environment (pgrep -u myUserName -l to get process list, pick a number, then tr '\0' '\n' < /proc/NUMBER/environ | grep DBUS). Then export DBUS_SESSION_BUS_ADDRESS with the value returned. Then the command ran. – RJFalconer Aug 23 '15 at 18:37
  • first command gives me: No such key “enabled” – stiv Aug 18 at 8:43
19

On Ubuntu 14.04, I found the following variation worked for me:

export DISPLAY=:0
gsettings set org.gnome.Vino enabled true
gsettings set org.gnome.Vino prompt-enabled false
gsettings set org.gnome.Vino require-encryption false
/usr/lib/vino/vino-server

If this doesn't work, your X session might be running on something other than :0, so a quick ps aux | grep X should show a :1 or :2

  • 1
    You should start with the export DISPLAY=:0 as the gsettings commands will fail without: failed to commit changes to dconf: Cannot autolaunch D-Bus without X11 $DISPLAY. – vaab Oct 6 '14 at 2:37
  • Best answer by far. But how do you make Vino auto-start on reboot? – pferrel Mar 20 '15 at 17:09
  • with this, the vnc port is open, but my vnc client halts forever. what can be the probem? – David Portabella Nov 2 '16 at 1:34
  • if your VNC client does not connect to the desktop, it is probably because the encryption remains activated. -- Each time you log-out and log-in again, you must disable the encryption again -- You can put these commands in a shell and invoke it when the desktop starts. Look for the "Startup application preferences" in your Ubuntu desktop. – Jaime Sep 1 '17 at 13:43
13

Why, for the love of all that is good in this hard world, is there no man entry for vino or vino-server or for any of the commands listed in dpkg -L vino's output? For that matter, why should any package at all be installed on an Ubuntu system, ever, which omits a man page at least for the relevant commands? Ok, rant over. The best answer I've found so far is here: http://ubuntuforums.org/archive/index.php/t-266981.html

I really hope this helps, and I hope that in future the Ubuntu community documents all these orphaned commands. "Ease of use" does not mean abandoning the command line, and it certainly does not mean abandoning easily accessible documentation. </grumble>

  • Try running /usr/lib/vino/vino-server. For what little help and docs is available, use vino-server --help-all. – koanhead Sep 22 '10 at 3:19
  • 4
    Linking to another source is bad, that source could go offline in the future and your answer would no longer be valid. – Phil Hannent Nov 9 '10 at 13:32
  • One extra point for the rant. – Marnix A. van Ammers Mar 19 '13 at 1:36
  • It's in /usr/lib, thus not a command the user would normally run, thus doesn't need a manpage … at least that's the reasoning. FWIW, I agree with you. – Matthias Urlichs Nov 16 '15 at 7:42
9

This doesn't seem to work remotely via ssh due to errors about the display and so on. Here's what I did:

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

Mostly works now!

  • Yes - finally! Without export DISPLAY=:0.0, the "remote" desktop I was getting was actually my local desktop (I use ssh -X). Also, it is necessary to "Allow other users" via vino-preferences (or the shell commands suggested in other answers) before running /usr/lib/vino/vino-server. Note: Probably any VNC client works with this once it is set up correctly, but vinagre seemed to provide the most sensible UI. – nobar May 29 '15 at 0:54
5

I was able to set a fresh Ubuntu 16.04 install from a remote ssh connection with the following script:

#!/bin/bash
export DISPLAY=:0
read -e -p "VNC Password: " -i "ubuntu" password
dconf write /org/gnome/desktop/remote-access/enabled true
dconf write /org/gnome/desktop/remote-access/prompt-enabled false
dconf write /org/gnome/desktop/remote-access/authentication-methods "['vnc']"
dconf write /org/gnome/desktop/remote-access/require-encryption false
dconf write /org/gnome/desktop/remote-access/vnc-password \"\'$(echo -n $password | base64)\'\"
dconf dump /org/gnome/desktop/remote-access/
sudo service lightdm restart

The quoting is important for any of the string settings (single ticks inside quotes). For dconf to be able to write it needs access to XWindows, so that's why the export DISPLAY part is needed. I think you still need to be logged in to the desktop on the actual Ubuntu machine to connect with VNC after this. The dump command is just there to confirm all the settings took hold, you don't really need that.

Optionally you may want to do this if you want to keep the display up all the time:

dconf write /org/gnome/desktop/screensaver/lock-enabled false
dconf write /org/gnome/desktop/screensaver/ubuntu-lock-on-suspend false
dconf write /org/gnome/desktop/session/idle-delay "uint32 0"
1

For anyone using Linux Mint 15, I got this all to work on my MintBox2 by doing the following. I can now run the MintBox 2 entirely headless with: ssh + vino + Tight VNC.

Type into putty via ssh connection to the LinuxMint MintBox2 machine:

sudo su
[enter your root password]
echo $DISPLAY
export DISPLAY=:0.0
startx &   }This loads up LinuxMint on screen as "root" user
[press the return key again to get back to BASH prompt]

Now, if you like (this isn't necessary) on a LinuxMint terminal (i.e. not on putty) type:

echo $DISPLAY

=> You get an output of :1 [i.e. this caused me a lot of trouble to figure out i.e this is not 0:0 !!!!!!!!!!]

Now, go back to putty and type:

echo $DISPLAY
export DISPLAY=:1
/usr/lib/vino/vino-server

=> It now loads & you can use window 7 Tight VNC Viewer to access Linux Mint etc

I hope this helps some one out there...

1

I had that same issue with xubuntu after 18.04 upgrade. First install vino. Mine was removed on upgrade without any notice. Also even after installing vino, the command vino-preferences doesn't work.

Here is an easy workaround:

  • Install dconf-editor

    sudo apt install dconf-editor 
    
  • then open it and go to /org/gnome/desktop/remote access and turn off encryption.

There are also several other remote options you can set in dconf-editor. However until you install vino, the remote-access doesn't show in dconf-editor.

I hope someone can explain what happened to vino-preferences.

-1
gsettings reset-recursively org.gnome.Vino
  • 5
    It would be helpful if you could edit your answer to explain what this does and how it answers the question. – David Edwards Apr 17 '14 at 10:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.