OpenSSH server installation

To install the OpenSSH server application on your Ubuntu server system:


sudo apt-get install openssh-server

Backup original configuration file

sudo cp / etc/ssh/sshd_config / etc/ssh/sshd_config.original
sudo chmod a-w / etc/ssh/sshd_config.original

Generate SSH keys
During the process you will be prompted for a password. Simply hit Enter when prompted to create the key.

ssh-keygen -t rsa

By default the public key is saved in the file ~/.ssh/, while ~/.ssh/id_rsa is the private key.

Copy file to the remote host
Copy the file to the remote host and append it to ~/.ssh/authorized_keys by entering:

ssh-copy-id username@remotehost


chmod 600 .ssh/authorized_keys

For more please visit ubuntu.