Guide for setting up OpenSSH on deb/ubuntu.
Install OpenSSH server
Ensure on the server OpenSSH is installed. If not you can install it by:
sudo apt install openssh-server
Settings
You'll likely need to change several settings for OpenSSH. First, it's worth first backing up the ssh_config file.
sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.backup sudo chmod a-w /etc/ssh/sshd_config.original.backup
Ensure you disable PasswordAuthentication so users can only SSH in with private keys.
... PasswordAuthentication no ...
Once configuration is done, restart ssh:
sudo service ssh restart
Generating keypairs
You can generate a keypair by (example using RSA) from your linux client with:
ssh-keygen -t rsa
You can then copy and append the client-generated public key (*.pub) to the open ssh server. Or more specifically, to a server user's "~/.ssh/authorized_keys"
file:
/home/<SERVER-USER-WILL-SSH-INTO>/.ssh/authorized_keys
The client should now be able to connect via SSH to the openssh server.
References
Related articles