Apple,  MacOS,  Web

How to – Use ssh to access server in Mac

Buying a server nowadays is very cheap. For just 5$ you can run a complete website. We will be doing a complete series in which we will show how you can create a whole site. So In this tutorial, we will show you how you can access your server from your Mac instantly. We will make the server in Digital Ocean. So we will show you how to use ssh to access server in Mac.

Step 1 – Creating the key

Go to terminal and type the following command


Now you will get a screen similar to this. This is asking for the location of the keys. For default, it stores them in a folder named ssh. Let’s go with that only. Just press enter.

Generating public/private rsa key pair. Enter file in which to save the key (/home/username/.ssh/id_rsa):

Once you select a location for the key, you’ll be prompted to enter an optional passphrase which encrypts the private key file on disk, As we are trying to use ssh to access server in Mac.

All Tech Tutorial recommends Accesories for Macbook Pro

If you enter one, you will have to provide it every time you use this key (unless you are running SSH agent software that stores the decrypted key). We recommend using a passphrase, but you can press ENTER to bypass this prompt.

Created directory ‘/home/username/.ssh’. Enter passphrase (empty for no passphrase): Enter same passphrase again:

This is the last step in the creation process. You now have a public and private key that you can use to authenticate.

Now you have successfully created the key. Now you need to add the key to your DO droplet. For that,  go to the path where we saved the keys, i.e. Home/username/.ssh. It would be a hidden file so make sure you turn on the option to view the hidden file.

Now open the .pub file and copy the contents of it.

Step 2 – Adding the key to your Droplet – Use ssh to access server in Mac

ssh to access server in Mac

Now Open Digital Ocean, Go to Create a droplet, Create one with the latest Ubuntu 32bit, Select the location of your server and the RAM and storage requirements, The basic 5$ is just fine for a small site. Select Add SSH key and just paste the key you just coded. Give it a name and select Save SSH key.

You have successfully added the SSH key to your droplet.

Also Read – How to Screen Record

Step 3 – Accessing your droplet from the terminal

Now to Access your server, First Go to Digital Ocean and copy the IP address of your server.

ssh to access server in Mac

Once copied, Open Terminal and type following code.

ssh root@ipaddress

Taking the example of this droplet,

ssh root@203:0:113:0

Now as the server is new for your machine. You might get a message similar to this. Just type yes and press enter.

With this, you have successfully connected your Mac to the server via ssh.

One Comment

Leave a Reply

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