How to configure Vino for remote desktop access using command line
Environment
- Red Hat Enterprise Linux 6
Issue
- Is it possible to set up the Desktop remote access through command line. Looking at System --> Preferences --> Remote Desktop, it is possible to set the "Allow other user to control your desktop" and then set a password? How is it possible to do the same thing with command line? What file(s) are modified?
Resolution
Setting Vino Password
- There are a few ways in which you can accomplish this but the most straight forward is to set the password using the command:
$ vino-passwd
- From here you can verify that the hash is recreated in the users home directory file
~/.gconf/desktop/gnome/remote_access/%gconf.xml
. In RHEL 6 the hash will be required. Here is an example below:
<?xml version="1.0"?>
<gconf>
<entry name="vnc_password" mtime="1363245761" type="string">
<stringvalue>cmVkaGF0</stringvalue>
- You can also generate the hash on the system using an echo command as shown in the below example here when I created a hash for the password "awesome":
[root@rhel6 ~]# echo -n 'awesome' | base64
YXdlc29tZQ==
- Once the hash is generated you can use this with the gconftool command:
$ gconftool-2 -s -t string /desktop/gnome/remote_access/vnc_password YXdlc29tZQ==
- After completion you can view the changes in the file
~/.gconf/desktop/gnome/remote_access/%gconf.xml
or tcan check by viewing the list of modes currently set in Vino. To view this run the command below and view thevnc_password
field:
gconftool-2 -R /desktop/gnome/remote_access
Root Cause
-
The changes that you make from the vino-preferences interface should write to the file:
/home/<user>/.gconf/desktop/gnome/remote_access/%gconf.xml
-
It's possible manually make changes to this file or use gconftool or the gconf-editor utility to set values that are defined in this file for each user. See the article below for more info on gconftool use:
-
The best way to determine how you any options you want using the preferences window and then observe the corresponding changes to the file. Setting the password can be a bit more of a pain. The reason for this is because vino generates a password hash that isn't easily appended by the file. Here is an example:
<?xml version="1.0"?>
<gconf>
<entry name="vnc_password" mtime="1363242588" type="string">
<stringvalue>cmVkaGF0</stringvalue>
</entry>
<entry name="authentication_methods" mtime="1363242584" type="list" ltype="string">
<li type="string">
<stringvalue>vnc</stringvalue>
</li>
</entry>
<entry name="prompt_enabled" mtime="1363242014" type="bool" value="false"/>
".gconf/desktop/gnome/remote_access/%gconf.xml" 14L, 525C
- With that said it is possible to use a command like the one below to change the value using gconftool by exicuting:
$ gconftool-2 -s -t string /desktop/gnome/remote_access/vnc_password <your-passwd>
- The issue here is that it wont work unless its a hash. See the value change of the file after setting my password to 'redhat':
<?xml version="1.0"?>
<gconf>
<entry name="vnc_password" mtime="1363244350" type="string">
<stringvalue>redhat</stringvalue>
</entry>
<entry name="authentication_methods" mtime="1363242584" type="list" ltype="string">
<li type="string">
<stringvalue>vnc</stringvalue>
</li>
</entry>
<entry name="prompt_enabled" mtime="1363242014" type="bool" value="false"/>
Diagnostic Steps
Additional information:
gconftool-2 -s -t bool /desktop/gnome/remote_acess/promt_enable
- The above worksworks but when trying to set a password you can not set the password that is not written in hash or else it will not work:
gconftool-2 --type string --set /desktop/gnome/remote_acess/vnc_password '123456'
- This works fine on RHEL 5 but dosen't set the password for RHEL 6.0
gconftool-2 --type string --set /desktop/gnome/remote_acess/vnc_password '123456'
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
Comments