How to SSH

SSH is secure shell it is an industry standard for accessing remote systems. SSH works by comparing the requestor's private key with the server's known public key. And is preferred over user/pass auth

Using a Terminal

First open a terminal. You'll need to know or posess the credentials for a user on the remote machine you're attempting to reach

ssh user@127.0.0.1

Use the IP address to avoid any potential DNS issues. Replace the 127.0.0.1 with the IP address of the target remote machine.

The default user on various AWS instances are as follows:

Ubuntu Image default user - ubuntu

Amazon-Linux Image default user - ec2-user

Wordpress with Bitnami (Website server) - bitnami

Within AWS you'll need an ssh key. You can create and download this via the AWS GUI when launching an instance. When you download your .pem file it'll show up in your downloads folder it is recommended you move this to the .ssh directory and updating the permissions. If the permissions aren't updated you won't be able utilize the private key.

mv ~/Downloads/*.pem ~/.ssh/ # mv is move, it moves a file from one 
# location to another. In this case from Downloads to .ssh
cd ~/.ssh
chmod 600 key.pem # change the permissions to user read and write only
ssh -i key.pem ec2-user@127.0.0.1 # execute the command to login

SSH will not use keys that are too permissive. It must be read/write by the owner only at a maximum.

Replace the key.pem file to the name of the .pem file you downloaded

Replace the 127.0.0.1 to the ip of the target machine.

How to SSH with Putty

You should only need to utilize putty in the absence of a terminal. Terminals are built in to all operating systems except Windows. Putty is specifically for ssh from a windows client. All other OS (i.e. linux, bsd, macOS) should follow the instructions above

Within AWS you'll need an ssh key. You can create and download this via the AWS GUI when launching an instance. When you download your .pem file it'll show up in your downloads folder it is recommended you move this to the .ssh directory and updating the permissions. If the permissions aren't updated you won't be able utilize the private key.

Download Putty

You'll also want to grab PuTTyGen as well, AWS will provide you with a .pem file. In order to utilize PuTTy for SSH you'll need to convert this file to a private key.

Open PuTTyGen upload your .pem file from AWS and split the key into a public/private key pair. Store this someone easy to remember, but secure as you'll add the file path to Putty.

Once you've downloaded and launched Putty. Go to the sidebar and expand the SSH and Auth options. You'll then click browse and navigate the location of your newly created privatekey.ppk file.

Afterwards navigate back to the Session tab. You'll be able to enter the IP address of the server under the "Host Name (or IP address) section as well as the SSH port under the "Port" section. For us it'll be the default of 22. Ensure your connection type is SSH

It is recommended that before clicking open you press save to save these settings, you'll also have the option to enter a name for these settings inside of the "Saved Sessions" box

Click open to launch the server and enter the username associated to your key.

The default user on various AWS instances are as follows:

Ubuntu Image default user - ubuntu

Amazon-Linux Image default user - ec2-user

Wordpress with Bitnami (Website server) - bitnami

Last updated