ssh-keygen -t rsa
- Copy contents of ~./.ssh/id_rsa.pub to publicly accessible location
- Or use GitHub as keyserver on https://github.com/${username}.keys
#!/bin/bash
# The user is stored in $1
curl -sf https://github.com/$1.keys
- Or use ssh to your own key server
#!/bin/bash
ssh my-secret-server "cat /home/$1/.ssh/*.pub"
- add those lines to /etc/ssh/sshd_config
ChallengeResponseAuthentication no
UsePAM no
PasswordAuthentication no
AuthorizedKeysCommand /usr/local/bin/userkeys.sh
AuthorizedKeysCommandUser nobody
Subsystem sftp /usr/lib/openssh/sftp-server