-- MikeGore - 24 Mar 2020

Linux Remote Desktop Access

24 March 2020 Mike Gore
Ubuntu 18.04LTS see RT# 1051887


Linux vpn.cs client setup - VPN required for remote access

  • See https://vpn.cs.uwaterloo.ca for details
    • Download the vpn.cs ovpn file
    • Click on network icon on toolbar
      • Click on VPN -> Connect -> Enter your CS-GENERAL password.

Setting up an Ubuntu 18.04LTS Desktop for remote access

  • You do not want to do this on a server
    • They do not run a GUI.
    • The added packages brought in might mess things up - especially network manager

Linux Ubuntu 18.04LTS Desktop setop for remote access

Desktop software install

  • Install Open VPN client
    • apt-get install gadmin-openvpn-client network-manager-openvpn network-manager-openvpn-gnome
  • Install Tiger VNC server and client
    • apt install tigervnc-standalone-server tigervnc-xorg-extension tigervnc-viewer
  • Install the GUI session manager you will use - I am using Gnome in my examples
    • apt-get install xserver-xorg-core ubuntu-gnome-desktop
  • Install and RDP server Windows remote desktop and Linux rdesktop clients can access the Desktop
    • apt-get install xrdp
  • Optionally install VPN and RDP client software so you can access other machines
    • apt-get install tigervnc-viewer rdesktop

Desktop Tiger VNC server configuration

  • *Setup a VNC password and make it complex (you can use login password)
    • This restricts who has access to your desktop
    • vncpasswd
      • Enter your login password twice, say NO to a view

Desktop VNC server manual startup script

  • Note on my system I start the server manually
  • Create a startup script called start_vnc
    • Update the display geometry below to suit your client display
               #/bin/bash
               #
               # Kill any existing servers
               vncserver -kill :*
               # Remove any previous stale/dead Xauth files
               xauth remove $HOSTNAME:1
               xauth remove $HOSTNAME:2
               xauth remove $HOSTNAME:3
               xauth remove $HOSTNAME:4
                              # Start vncserver
                              vncserver :1 -localhost -geometry 1800x1000 -depth 24
            

Desktop VNC server client session startup script

  • Done once
  • The script below will launch your chosen session manager when a client connection is made
    • In my example I use Gnome - I have included other options commented out
  • cd ~/.vnc
  • sudo bash
  • gedit Xvnc-startup
             # Start Gnome 3 Desktop 
             # [ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
             # Or
             # [ -x /etc/X11/Xvnc-session ] && exec /etc/X11/Xvnc-session 
             # [ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
             # Or
             /usr/bin/vncconfig -iconic &
             /usr/bin/dbus-launch --exit-with-session /usr/bin/gnome-session &
          
  • chmod 755 xstartup
  • ln -s xstartup Xvnc-startup

XRDP setup for Linux rdeskop and Windows remote desktop access

  • Done once
  • Update xrdp.ini adding restrictions on where XRDP will forward requests to
  • I simplified mine so I will be presented with only one choice with defaults sets
  • We will comment out all [] sections but [vnc] - we will modify [vnc]
    • sodo bash
    • gedit /etc/xrdp/xrdp.ini [vnc] name=Xvnc lib=libvnc.so username=na password=ask ip=127.0.0.1 port=ask5901 #xserverbpp=24 #delay_ms=2000
    • Restart xrdp
      • systemctl restart xrdp

Client connection process

  • Make sure your desktop VNC server is running
    • Open a terminal
    • ssh -X userid@host.cs.uwterloo.ca
      • Change userid to yours and host to your desktop
      • Check the xtightvnc server status
        • vncserver -list
      • If you see no sessions listed then start the server
        • ~/start_vnc
  • Important on very first access
    • if you have a session manager already running (ie Gnome) on your desktop you need to kill it
      • Otherwise you will get a connection failure from your clients

Connecting to the Desktop remotely from Linux clients

  • Make sure you have rdesktop installed
    • Example: From a terminal sudo apt-get install rdesktop
  • Starting session
    • open a terminal window and type:
    • rdesktop -r sound:local:alsa -g1850x1000 host.cs.uwaterloo.ca -u userid
        • replace host and userid *with your remote host name and *userid
      • The session will ask for your VNC password you set earlier
        • It will ask you Three times!

Connecting to the Desktop remotely from Windows clients

  • In the search bar type remote desktop
    • Click on the highlighed Remote Desktop app
      • Enter the fully qualified hostname like host.cs.uwaterloo.ca
        • replace host *with your remote host name
      • The session will ask for your VNC password you set earlier
        • It will ask you Three times!

FreeNX

This section is very old
  • See TWIKI link FreeNX
  • FreeNX is a system that allows you to access your desktop from another machine over the Internet. You can use this to login graphically to your desktop from a remote location. One example of its use would be to have a FreeNX server set up on your home computer, and graphically logging in to the home computer from your work computer, using a FreeNX client.

SSH"> Using VNC or RDP it with SSH

Then
  • rdesktop localhost::5999
- or -
  • xvnc4viewer localhost::5999 -ZlibLevel 9 -UseLocalCursor
Edit | Attach | Watch | Print version | History: r10 < r9 < r8 < r7 < r6 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r10 - 2020-03-25 - MikeGore
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2020 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback