In order to view the desktop of another Ubuntu 16.04 LTS machine follow these steps. I performed these actions to make my life easier on my home cryptocoin mining network – this is not the most secure method. But, it works and I can get to my machines. I perform these steps right after building a new box.
Unencrypted Home Directory Pre-requisite: If you want to have your remote machine auto-login so that you can remote into it whenever you need…you will have to unencrypted your home directory if it is encrypted. Follow this link and steps (PDF Version). Pre-pre-requisite: If you do indeed need to perform these unencryption steps, you will need to know how to create another sudo user (link PDF Version)
If you intend on running your “remote” machine as headless (i.e. no monitor) you may need to follow my steps to fake the box out to think it has a monitor connected. If you have a rig that you see runs XOrg at high CPU and you aren’t mining, you may be suffering from a headless server that needs to be tricked!
From your “viewing” machine:
- ssh to your “sharing” machine
- See if vino-server is installed
$ locate vino-server
- If the above comes back blank then:
$ sudo apt-get install vino
- Now we have to configure the vino-server
$ export DISPLAY=:0.0 $ dbus-launch gsettings set org.gnome.Vino enabled true $ dbus-launch gsettings set org.gnome.Vino prompt-enabled false $ dbus-launch gsettings set org.gnome.Vino authentication-methods "['vnc']" $ dbus-launch gsettings set org.gnome.Vino vnc-password "$(echo -n "YOU-ENTER-A-PASSWORD-FOR-DESKTOP-SHARING-HERE" | base64)" $ dbus-launch gsettings set org.gnome.Vino require-encryption true
- The first bolded above is the area you need to enter the password you will enter from the client machine
- Regarding the bold field under encryption: if you are connecting from another Ubuntu machine leave it as “true.” If you are connecting from a Mac…then switch it to “false.” On macs use the program called “screen sharing” that ships with OS X (hit command+space to bring up spotlight and search for “screen sharing”).
- The dubs-launch command is needed because we are executing this remotely from shell prompt
- The first command related to the DISPLAY variable needs some extended discussion. First, to see what value it holds you can run “echo $DISPLAY”. The format of the display variable is hostname:display.screen (where the hostname is usually omitted, both display and screen start at 0, and if screen is not provided it defaults to 0). Now in this context, the definition of “display” is nuanced. It conceptually means a collection of monitors that share one set of input devices (e.g. mouse and keyboard). “screen” just means the monitor number for the “display” of interest. Ref
- This is how you run it
Did it give you an error…something like “Could not connect: Connection refused Cannot open display:”? If so continue to the next step.
- In order to start vino-server remote machine must be showing some sort of graphical interface. The remote machine cannot be stuck on the login screen. To work around this we need to configure the remote machine to automatically login. If you do happen to try running /usr/lib/vino/vino-server without doing this you will receive
- To autologin:
$ sudo mkdir /etc/lightdm/lightdm.conf.d $ sudo nano /etc/lightdm/lightdm.conf.d/50-myconfig.conf
- Let’s configure vino-server to autostart. I tried a couple of different methods, and the following was the easiest and cleanest. Doing this at the command line will actually populate entries on the “Application Autostart” tab of the “Session and Startup” application in the GUI.
$ mkdir ~/.config/autostart $ cd ~/.config/autostart $ nano Vino.desktop
[Desktop Entry] Name=Vino Server Exec=/usr/lib/vino/vino-server Type=Application
In my case I have a Claymore95 miner, and I want it to autostart too!
$ nano Claymore.desktop
Now, the following shows what the GUI will populate
[Desktop Entry] Encoding=UTF-8 Version=0.9.4 Type=Application Name=Claymore Comment=mining Exec=/bin/bash -c "sleep 10 && cd /usr/local/claymore95/ && nohup ./mine.sh &" OnlyShowIn=XFCE; StartupNotify=false Terminal=false Hidden=false
- Let’s restart the server machine!
$ sudo shutdown -r now
- On the client machine, you need to download the remote viewer. From the Start menu, run the Software application. Within, download the “Remote Desktop Viewer.”
- Now, at this point the server should be restarted. You can now run the “Remote Desktop Viewer” to connect. You should get prompted for the password you established above, and you should see the shared remote desktop!