Press "Enter" to skip to content

Connect to server via SSH on Mac with Security Key File and Host Name

In the last tutorial, I shared a guide on how to connect to a dedicated, cloud or virtual private server via SSH using hostname, username and password. In this tutorial, I am going to talk about how you can connect to your server via SSH using PEM security file and the hostname.

To connect to the server, I am on Mac OS and using Terminal as the SSH client.

Before starting, I am assuming that you have downloaded your security key file. Once you have downloaded, change the file permissions by entering the below code in terminal

chmod 600 security-file-location

Make sure to correctly put the location of your security key file. The location is in for the format of user/username/downloads/file_name

When you press enter after entering your file location and if the path and command are correct, the terminal will show no error. Once done, you can follow the next steps

How to connect to a server using Security Key File and Host Name on Mac using terminal

  • Open terminal and type the below command with correct credentials (security key path, username and the hostname)
    ssh -i security key path [email protected] (IP address)
    Mac Terminal SSH Command
  • Make sure you enter the correct username and hostname. Username will depend on the kind of server and OS you are using. In case of Ubuntu servers, the default username is Ubuntu. Check your username from the host before trying to connect via SSH.
  • If your credentials are correct, you will see the welcome screen and that means, connection to your server using SSH has been established.

If you have any queries, feel free to let us know in the comment section. Also, you can email to us at [email protected] and I will try my best to solve any issue you might have.

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *