If you’re using Ubuntu 18.04, you can enable remote desktop connections right now with just three easy steps. Whether you’re enabling this functionality to help friends and family access their files on your computer or so that you can connect to your own computer from outside the network, it’s an incredibly easy process and this guide will walk you through it. You’ll need to be logged in as an administrator, but anyone can do that! So let’s get started!
Step 1: Install the OpenSSH server
Ubuntu 18.04 comes with OpenSSH server pre-installed, but you can install it if for some reason you don’t have it already. To do so, open up a terminal window and type:
sudo apt-get install openssh-server a) You will be prompted to provide a password for the user ‘root’. Enter your desired password (enter twice) and press enter.
- b) After installing the software, type exit to log out of root mode and return to the regular user account.
Step 2: Configure Passwordless Connection
To enable passwordless connection, open the following file: ~/.ssh/config and add this line:
Host * StrictHostKeyChecking no PasswordAuthentication yes ForwardX11 yes (The last two lines should be added) Finally, save the file by pressing CTRL+X and confirm by typing y for yes. Now you are ready to connect to your Ubuntu computer from any other Linux machine on your network.
Go ahead and ssh into your ubuntu system with the following command: ssh user@hostname-or-ip -address -p portnumber
To disconnect from your remote session, press CTRL+D or type exit in the terminal window where you’re connected.
Step 3: Test the connection
Once you’ve completed the steps and enabled remote desktop connections, it’s time to test them. Find the IP address for your machine (it will either be assigned by your router or DHCP server). You can use the hostname too but it may not always resolve correctly so we recommend trying IP first, if that doesn’t work then try using hostname as well. Open up a terminal window and type: ssh username@ipaddress. Make sure to replace username with the username of your account on the remote computer, and ipaddress with its IP address.