Ssh keypair
Setting up an ssh keypair from a linux system
If you haven't already, create a keypair.
$ ssh-keygen -t rsa
Enter a password for the private key. Store the key in your password vault. If you go with defaults, the filename created for your public key will be id_rsa.pub and will be located in your .ssh folder. Next, copy your public key to the destination system.
$ scp -P <port> ~/.ssh/id_rsa.pub username@<ip address>:
Log into the destination system.
$ ssh -p <port> username@<ip address>
If needed, create a hidden directory to store ssh data and create an authorized keys file.
$ mkdir -p ~/.ssh && touch ~/.ssh/authorized_keys
Add your public key to the authorized keys file.
$ cat ~/id_rsa.pub >> ~/.ssh/authorized_keys
If desired, confirm that your key was successfully entered into the file.
$ more ~/.ssh/authorized_keys
If desired, remove the public key file.
$ rm ~/id_rsa.pub
Log out of the system. Try logging in again; you should be prompted to enter the password you set for the key in the first step.
$ ssh -p <port> username@<ip address>
Once confirmed, log out of the system. If desired, create a file to make future logins easier:
$ sudo nano /usr/local/bin/<desired name>
Paste the command you used in the above step and save the file. Set it as executable
$ sudo chmod +x /usr/local/bin/<desired name>
You can now log into the remote system simply by executing
$ <desired name>