enable Remote Desktop thru terminal

There are several way to activate function programe in Ubuntu thru terminal that we are hard to find in the help menu. But with a little search we can find them in ubuntu help.
What make me curious was how to activate or disactivate the remote desktop function in ubuntu through terminal console. Especially when we want to activate the client’s remote desktop. Of course the client doesn’t have to know about it.

First we need to make sure port 22 is open. We can not change anything in client’s computer if we are not inside it. Let’s say it is open. So connect to it, and do these command :

gconftool-2 -s -t bool /desktop/gnome/remote_access/enabled true ## to enable the remote desktop
gconftool-2 -s -t bool /desktop/gnome/remote_access/prompt_enabled false ## to disable the remote desktop
gconftool-2 –type bool –set /desktop/gnome/remote_access/use_alternative_port true ## to set another port, the default is 5900
gconftool-2 –type int –set /desktop/gnome/remote_access/alternative_port 5909 ##define the alternative port

For vnc use these command

gconftool-2 –type list –list-type string –set /desktop/gnome/remote_access/authentication_methods ‘[vnc]’
gconftool-2 –type string –set /desktop/gnome/remote_access/vnc_password mypassword

The exact location of gconf file setting is here:

/root/.gconf/desktop/gnome/remote_access

But sometime in my other computer, those above command is not working. So we need something else. Like running the vino-server command. Vino-server is the remote desktop command, but it seems different when we access it from inside ubuntu desktop.

First Set the client’ setting. The weakness is we have to access the client’s computer personally without him. How can I do that? Well cause the computer’s lab are in my hand so it’s easy for me.
#sudo vino-preferences
It will come up with some dialogue. Fill in the boxes depend on what you want.
and press close. The setting in vino will remain that way. That’s it.

Now when we want to activate the remote desktop, connect to ssh chanel that I already set it up first in the client.
And run this

#sudo /usr/lib/vino/vino-server

Then go back to your terminal and check which port that open. Usually 5900 or 5901. Finally use your vncviewer to access it.
#vncviewer 192.168.x.x:5901

To make it automatically run in client computer during booting add the script to /etc/rc.local in client computer.
#!/bin/sh -e
export DISPLAY=:0.0
/usr/lib/vino/vino-server –display=:0.0 &
exit 0

source : ubuntu help

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.