SSH Server Pubkey Auth
Jun 17, 2025
Setup ssh server that authenticates using pubkey and disable password authentication.
sudo apt install openssh-server -yThen edit the config file
sudo vim /etc/ssh/sshd_configSet to the following below
PasswordAuthentication no
PermitRootLogin no
UsePAM no
KbdInteractiveAuthentication noPubkeyAuthentication yesGet Kevin FOO’s stories in your inbox
Join Medium for free to get updates from this writer.
AuthorizedKeysFile .ssh/authorized_keys
In your client, assuming your pubkey is at its default location. Cat the pubkey copy it.
cat .ssh/id_ed25519.pubPaste the copied pubkey to the server authorized_key
vim .ssh/authorized_keyRestart ssh server
sudo systemctl restart sshd







