Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

We have more than 500 systems running ubuntu in our office. And sometimes after installation we forget to enable to Remote desktop. So that we was not able to control that PC remotely. Is there any way to access that machine remotely using SSH? Coz ssh was installed in that remote machine. Also if that machine was in login screen we was not able to view through vnc. I guess SSH will be a good solution. Can anyone help me? Thanks in advance.

share|improve this question

3 Answers 3

up vote 2 down vote accepted

Use SSH to get to the machine. Ask gnome not to ask, "Are you sure?" after enabling the remote desktop access. Then enable remote access.

gconftool-2 -s -t bool /desktop/gnome/remote_access/prompt_enabled false
gconftool-2 -s -t bool /desktop/gnome/remote_access/enabled true

You could create scripts for this, too, maybe /usr/local/bin/start-remote-desktop.sh.

Use your favorite editor over vim if you like...

sudo vim /usr/local/bin/start-remote-desktop.sh

The contents of that file:

#!/bin/bash
gconftool-2 -s -t bool /desktop/gnome/remote_access/prompt_enabled false
gconftool-2 -s -t bool /desktop/gnome/remote_access/enabled true

Make it executable:

sudo chmod 0755 /usr/local/bin/start-remote-desktop.sh

Add it to your default user configuration:

sudo sh -c 'echo "/usr/local/bin/start-remote-desktop.sh" >> /etc/skel/.profile' 

As far as the human factor goes in maintaining 500 workstations, you would love using CloneZilla. The one CloneZilla server provides pre-configured images for the workstations which can be installed over the network. You can even multicast them so that in just a few hours, to guess, all the workstations can be imaged with a common configuration, same version, etc... There's a good tutorial on dedoimedo.com.

share|improve this answer
    
What is this? Ask gnome not to ask, "Are you sure?" –  karthick87 Dec 13 '11 at 16:04
    
When you try to turn on the remote access, gnome may prompt, "Are you sure?" to enable remote desktop access. –  user8290 Dec 13 '11 at 16:06
    
gconftool-2 -s -t bool /desktop/gnome/remote_access/prompt_enabled false –  user8290 Dec 13 '11 at 16:09

I'm a fan of x11vnc. It's a simple VNC server and you won't have to mess around with Gnome settings or 500 firewalls, just install x11vnc on all your computers (with puppet or whatever you're using for mass-control).

Then from your local computer run:

ssh user@host -L 5900:localhost:5900 "x11vnc -display :0 -noxdamage"

Obviously swapping user@host for the username and hostname/IP of the remote computer.

And then use a VNC client of your choice to connect to localhost:5900. The SSH command starts a vnc server on the remote computer and then tunnels back that port over SSH. You don't have to open up any ports (as long as you can already SSH).

If your computers have funny display settings, you might do better to leave off the -display :0 segment in the SSH command. x11vnc will then automatically try to find the right display.

This method is better than just running a VNC server on every machine because you're not going to slow every machine down all the time. It's also considerably less of a security risk as the SSH user is the only person who's going to see the VNC server; always-visible, always-on VNC servers are popular target hacks.

share|improve this answer
    
Wow, this is much easier than meddling in Gnome settings - and works everywhere, Gnome not required. Thanks! –  Piskvor May 31 '13 at 10:52
    
I have adapted your instructions into a simple script which SSHs to the given host, launches a VNC viewer and closes the tunnel when it's done: so.piskvor.org/87443/vncssh.sh –  Piskvor May 31 '13 at 12:01
    
Nice idea @Piskvor! –  Oli May 31 '13 at 14:48
    
If you are using vncviewer with a slow ssh connection, your command should look like vncviewer localhost::5900 -viewonly -encodings "tight" -quality 0 (on Debian/Ubuntu the viewer is from tightvnc) or vncviewer localhost::5900 -viewonly -PreferredEncoding tight QualityLevel=0 (on Red Hat/Fedora the viewer is from tigervnc), where quality level on both Debian and Redhat is between 0 and 9, where 9 is best, but needs fast connection. –  erik Feb 24 at 9:31

I'm not sure what you're asking. If you're comfortable administering a machine from the command line, ssh is all you need. If you want a GUI, though... You could install and start a standalone VNC server (tightvncserver or vnc4server) over ssh -- one that doesn't control the existing GUI session, but starts a new one, visible only through VNC.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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