Enable remote VNC from the commandline?

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

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

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

Tags:

Vnc

Vino