Connecting to a server via SSH on MacOS
SSH (Secure Shell) is a protocol for securely accessing remote systems over a network. This guide explains how to connect to a server via SSH on a macOS device.
Requirements
To connect via SSH on a macOS device, you will need:
- SSH client: the built-in SSH client available in the Terminal application.
- Server details: the IP address or hostname of the server, as well as its SSH port number (usually 22).
- SSH credentials: the username and either the account password or an SSH private key, depending on the server configuration.
Connecting using Terminal
Open the Terminal application and run the following command:
ssh username@server_IP
Replace username with your actual username and server_IP with the IP address or hostname of your server.

If you are connecting to the server for the first time, SSH will report that the authenticity of the host cannot be established and will show the server's key fingerprint. If you have a trusted fingerprint from your provider or administrator, verify that it matches, then enter yes to continue. The server's host key is then saved to ~/.ssh/known_hosts. You will not normally be asked to confirm the same host again unless the host key changes or the corresponding entry is removed.
If password authentication is enabled, enter the account password when prompted. If key-based authentication is configured, SSH authenticates you using your private key. After successful authentication, you will be connected to the server console.

If the server uses a non-standard SSH port, specify it with the -p flag:
ssh -p 22777 username@server_IP
If the connection fails, verify that the server is reachable and that SSH is running on it.
Connection using Termius
Termius is a third-party SSH client with SFTP support for macOS.
Creating a new host
In the Hosts section, select New Host. In the Address field, enter the IP address or hostname of your server, and set the SSH port if it differs from 22. Under Credentials, enter the Username and, if you use password authentication, the Password. You can also give the host a recognizable name.

Connecting to the host
After saving the host, return to the Hosts tab and select it to connect. When connecting for the first time, Termius shows the server's key fingerprint. If you have a trusted fingerprint for the server, verify it before accepting the connection.

Using SSH key authentication
In addition to password authentication, SSH key authentication is also available. Edit the saved host and, under Credentials, open Key, Certificate, FIDO2. Add your SSH key through the Termius keychain, where you can import an existing key or create a new one, then save the host.


Before using key-based authentication, make sure the corresponding public key is added to the ~/.ssh/authorized_keys file on the server. Without this, the key will not be accepted.
SFTP file transfer using Termius
The Termius application includes an SFTP file manager with a two-panel interface, allowing you to transfer files between your Mac and the server.

Open the SFTP tab to access the file manager. One panel shows Local, the files on your Mac. On the other panel, use Select host to connect to your saved server. You can then upload and download files between your Mac and the server, as well as manage files in either location.
