How to connect to Ubuntu from macOS
If you use Ubuntu Linux but also use an Apple computer running macOS, you may be interested in finding out how to connect your Mac to Ubuntu. In this guide, we will go over how easy it is to connect to Ubuntu from Mac OS using the command-line, and the GUI as well.
Before we begin
To connect to your Ubuntu Linux PC from a computer running Mac OS, you must have an SSH server up and running on Ubuntu. Not to worry, setting this up on Ubuntu is very easy compared to a lot of other Linux operating systems.
To start the process of setting up an SSH server, open up a terminal window on the Ubuntu PC. You can do this by pressing Ctrl + Alt + T or Ctrl + Shift + T on the keyboard. Once the terminal window is open and ready to go, use the apt install command to install the openssh-server
package on the system.
sudo apt install openssh-server
Let the packages install to your Ubuntu PC. When the process is complete, use the ssh localhost command in the terminal. This command will initiate a connection to the SSH server running on Ubuntu and will allow you to test if the connection is indeed working and ready to go.
ssh localhost
Assuming the connection is successful, you will be asked to accept the SSH key. Do so. You will then be connected to the Ubuntu SSH server locally. From here, use the exit command to finish the test.
exit
Setting up SSH on Ubuntu is very simple, and essential to being able to connect your Mac to the operating system. However, not everyone understands SSH. If you had trouble following along with this guide, head over to our in-depth tutorial on SSH to get your server working.
Connect to Ubuntu from the command-line
If you’re a developer and you need access to Ubuntu from the Mac, you’ll probably be wanting access to the command-line. Thankfully, it is possible to connect to Ubuntu from the macOS terminal over SSH.
To start a connection to your Ubuntu PC from macOS, open up the Mac terminal. You can open Terminal from the Applications folder, from the Launchpad, or by searching for it in Spotlight. If you decide to access it from the Applications folder, you will find the Terminal app inside the Utilities folder nested under the Applications folder. Likewise, in Launchpad, the Terminal app is going to be inside the Utilities folder.
Once you have Terminal open, follow the step-by-step instructions below to learn how to connect to Ubuntu over SSH from Mac OS.
Step 1: Write out ssh in the terminal prompt.
ssh
Step 2: Followed by ssh, enter the username of the Ubuntu computer you’re trying to connect to over the command-line. If you can’t figure out the username, go to the Ubuntu PC, and open up a terminal. The user is the name before @ sign. For example:
derrik@ubuntu-pc
Step 3: Followed by the username, write an @ sign, and the hostname of the remote Ubuntu PC. Again, if you can’t remember the hostname, it is shown in the Ubuntu terminal. For example:
derrik@ubuntu-pc
Step 4: Press the return key to initiate the connection to Ubuntu. Be sure to accept the message that pops up when you start a connection.
When the SSH connection is successful, feel free to use the command-line as if you were sitting right in front of the PC!
Connect to Ubuntu from the GUI
You may want to connect to your Ubuntu PC to access its files. The best way to do this is with SFTP, the Secure FTP Server that comes with SSH. To do an SFTP connection on the Mac, you will need a good FTP client, as Finder does not accept SFTP connections. In this guide, we will use Transmit, as it is a very simple to use tool for Mac OS.
Step 1: Download and install the Transmit FTP client on your Mac computer and install the app.
Note: Transmit is not a free app, but it comes with a free 7-day trial. However, if you like it as it makes accessing Ubuntu files on the Mac easier, you can purchase a license here.
Step 2: On the right side of the app, you will see a connection window. Select “SFTP” in the drop-down menu. Then, fill out the hostname of the Ubuntu PC, username, and other connection details.
Step 3: Find the “Connect” button, and click it to log in over SFTP to the Ubuntu PC.
Once Transmit is connected, you will have access to the files on the remote Ubuntu PC from the Mac. From here, you can upload or download files and folders with ease!