Brief
Surmise ssh management on Linux
How to create a ssh key pair
execute ssh-keygen command and then $HOME/.ssh directory and $HOME/.ssh/id_rsa and $HOME/.ssh/id_rsa.pub are created automatically by default.
# .ssh folder permission
chmod 700 $HOME/.ssh
chmod 600 $HOME/.ssh/id_rsa
How to add a public key on a ssh server
# add a public key
cat <public key file> >> ~/.ssh/authorized_keys
# change permission
chmod 600 ~/.ssh/authorized_keys
# If from is used, the access origin can be limited
e.g.
from="xxxx.xxxx.xxxx.xxx",no-pty ssh-rsa ***
How to configure ssh authentication
// Modify /etc/ssh/sshd_config and comment out the blow portions.
#RSAAuthentication yes
#PubkeyAuthentication yes
#AuthorizedKeysFils .ssh/authorized_keys
// To make a password authentication off
PasswordAuthentication no
After modified, restart sshd
No comments:
Post a Comment