Connect to your Linux machine from Windows or Mac

I’m in the process of setting up a NUC with PopOS and wanted to be able to SSH and RDP into the NUC from either Windows or Mac.

SSH

So, to start I needed to enable SSH on the NUC.

  1. Check if an SSH server is already installed
ssh localhost

1a. If you get the message, then you need to install the SSH server

ssh: connect to host localhost port 22: Connection refused

2. First update your package repository

sudo apt-get update

3. Then install OpenSSH

sudo apt-get install openssh-server

4. Verify the status of your SSH server

sudo service ssh status

It should say active (running)

There are a lot of choices in SSH clients. My favorite one for Windows is MobaXTerm, and I use Termius on Mac. Basically you need to know the:

  1. the IP of the machine
  2. the username
  3. the password
  4. the port which is the default SSH port of 22

To get the IP on a Linux machine, type IFCONFIG at the command line. Once you run IFCONFIG, you are looking for something like this:

Once you have all the information you need to connect via SSH, it’s a simple matter of putting it into your SSH client. Usually your SSH client will let you save your username and password with your connection information to make it easier to connect the next time, but this first time you will need to input all of it.

RDP

Since you already have an RDP client on Windows, you can install xRDP onto Linux to allow RDP access.

  1. To install xRDP
sudo apt install xrdp

2. You will need to press “y” and hit enter to continue

3. Then enable xRDP to automatically startup when you restart your machine

sudo systemctl enable xrdp

Then get the IP of your Linux machine with IFCONFIG at the command line. Use this IP to RDP into your Linux machine from your Windows machine using the Remote Desktop Connection app already instead with Windows.

NOTE: It will only show a black screen in your Windows RDP session if you are logged in as the same user on your Linux machine, so you will need to logout as that user on Linux before trying to RDP in Windows, or better yet, setup another user you can use to RDP into Linux so you can be logged in both places. Here are some basic steps to create a new user: https://linuxize.com/post/how-to-create-users-in-linux-using-the-useradd-command/

In Mac, you can use Finder to RDP to another machine. In the menu of Finder, use Go –> Connect to Server. I’ve had trouble using this though, so I use the Microsoft Remote Desktop and it seems to work better.

My Linux machine was getting it’s IP dynamically, so to avoid any issues with the IP changing, I assigned it a static IP. This is beyond the scope of this blog, but there are many resources online to help you.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.