Is there a way to view (and control) a remote desktop through SSH? I will not have physical access to the remote host machine.
|
Method 1 :This can be achieved with vino vnc server & remmina (both come default with ubuntu; if not install it by running
Method 2:
Then from your local computer run:
Obviously swapping And then use a VNC client of your choice to connect to If your computers have funny display settings, you might do better to leave off the Source: askubuntu |
|||||||||||||||||||||
|
Overview of SolutionAssuming you have already setup an Next create a Remote Desktop Client profile on your client machine in order to connect to the host machine through an SSH tunnel and ultimately view and control the host machine's desktop through an SSH tunnel. 1a. Locally Enable Remote Control of Host MachineDo the following on the host machine:
1b. Remotely Enable Remote Control of Host MachineDo the following on the client machine, replacing
Create Remote Desktop Client profile on your Client MachineDo the following on the client machine:
Ctrl+N or Connection > New
View and Control Host MachineOn the client machine, when asked for If successful at this step, you should now be viewing and controlling the host machine's desktop from your client machine through an SSH tunnel. |
|||||||||
|
I use
|
|||
|
|
|
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" |
||||
|
|
|
How to start Vino server remotely without forwarding X (command line-only) Log on the remote computer as the user who will share their desktop and forward port 5900 to the same port on localhost. With PuTTY, the redirection is set in Connection/SSH/Tunnels. With a command line, use:
Install
Enable desktop sharing (matching the display number on 1st and 2nd lines):
Start a VNC viewer and connect to |
||||
|
|
|
based on @Khurshid Alam answer I present the following snippet:
|
|||
|
|




