What do you think? Discuss, post comments, or ask questions at the end of this article [More about me]

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

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

  1. https://help.ubuntu.com/lts/serverguide/openssh-server.html



  • No labels