CentOS configured an implementation of password less login

  • 2020-06-07 05:55:04
  • OfStack

CentOS configuration password - free login

Configure sshd service to modify /etc/ssh/sshd_config on the server:

< !-- lang: shell -- >


# ban root The login 
PermitRootLogin no

# Specify users who can log in 
AllowUsers bob alice
StrictModes yes

# Turn off password authentication 
PasswordAuthentication no

# Open the RSA Verify related Settings 
RSAAuthentication yes
PubkeyAuthentication yes

AuthorizedKeysFile   .ssh/authorized_keys

# Shut down  GSSAPI validation 
GSSAPIAuthentication no

Restart the sshd service

Generate ES21en-ES22en Switch to the user account that allows ssh to log in by executing the following command:

< !-- lang: shell -- >


# generate key-pair
ssh-keygen 
cp ~/.ssh/id_rsa.pub ~/.ssh/authorized_keys
sudo chmod 600 ~/.ssh/authorized_keys
sudo chmod 700 ~/.ssh
restorecon -R -v ~/.ssh

Copy the id_rsa file just generated to the local, 1 commonly named: server.pem


ssh -i server.pem username@server

Thank you for reading, I hope to help you, thank you for your support to this site!


Related articles: