Centos 6.8 Public Key Log

# lsb_release -a
LSB Version:    :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch
Distributor ID: CentOS
Description:    CentOS release 6.8 (Final)
Release:    6.8
Codename:   Final

Centos 6.8 Public Key Log

first step:

Modify the file

# vim /etc/ssh/sshd_config

Open public Log

#开启秘钥登录
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile      .ssh/authorized_keys

Restart sshd

service sshd restart

Step two:

Modify the file

vim ~/.ssh/authorized_keys 

Increase their local public key file contents

# cat ~/.ssh/id_rsa.pub 
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDU3UxwVJVTqY80s9HhGrBue3PIbsvWuIkXxIokPLN8C6mSUW/PeJQ73jjp1ZXEEygePXkxAou7JsPBItHQ5C7U1Zg6rAt3x7JTccNjvoVIRRbpxLY4AK/qlr1nEHtLxGEfCTtZ4pVrtEyLXQDGYIS6lexvA96z9Z19YfZLRRkzbPp6Jud8kBG+j3hLAlfXMkB/+HJ6HFOQ7Sa5DUoZn98on0LvZPdThxwxBpLcNqjIZ3tiTUobnY1EKbi/8kcq9tS8vLoPFdsEQM4F3pe9P6cXQGaHy73z06/tWGfsVlGomJFSOrvNvtPXd/SsRRLrUMlE8yM7zQaoZULNG7KEVyb jiqing@JQ-Mac

third step:

Public key logon attempt

$ ssh root@xxx
Last login: Wed Dec  4 11:28:52 2019 from 218.93.209.11

Welcome to Alibaba Cloud Elastic Compute Service !

the fourth step:

Modify the file

# vim /etc/ssh/sshd_config

Remove password

PasswordAuthentication no # 禁止密码登录

Restart sshd

service sshd restart

Guess you like

Origin www.cnblogs.com/jiqing9006/p/11981944.html