SSH – connect to server using private and public key pair

Method #1

ssh-keygen -t rsa                      # Generate a private and public key pair
ssh-copy-id username@hostname          # Copy public key to remote host
ssh username@hostname                  # Connect to remote host using private key

# Optional - create an alias for whole connection string
echo 'alias aliasname="ssh username@hostname"' >> .bashrc
source ~/.bashrc

Method #2

ssh-copy-id -i ~/.ssh/id_rsa.pub username@hostname -p 55044
ssh -i ~/.ssh/id_rsa username@hostname -p 55044
echo 'alias aliasname="ssh -i ~/.ssh/id_rsa username@hostname -p 55044"' >> .bashrc
source ~/.bashrc