10/26/2016

Setup ssh connection on Ubuntu

Install necessary packages:



Host:
sudo apt-get update
sudo apt-get install openssh-server
sudo ufw allow 22
Client:
sudo apt-get install openssh-client


Connect usage:

ssh username@host

Advanced:

On the client side, create the host alias for ssh. Edit ~/.ssh/config, then copy the below pattern to the config file
Host workstation
HostName 10.70.70.44
User darrenl
Port 22
Then, we can simply the usage to connect to host
ssh workstation
Copy the public key to remote host using ssh-copy-id, thus, we didn't need to type password every time

ssh-copy-id -i ~/.ssh/id_rsa.pub remote-host


-