centos配置私鑰登錄
阿新 • • 發佈:2017-11-05
centos ssh服務
一.生成密鑰的公鑰和私鑰
1.ssh-keygen -t rsa
二.將生成的私鑰(id_rsa)下載到本地的windows機,並把公鑰導入到.ssh/authorized_keys 文件中去
1.#cd /root/.ssh/
2.#cat id_rsa.pub > authorized_keys
三.sshd配置
1.sshd配置文件路徑 /etc/ssh/sshd_config
2.
四.設置sshd 服務器服務,打開以下設置:
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile /root/.ssh/authorized_keys
ChallengeResponseAuthentication no
PasswordAuthentication no
UsePAM no
五.重啟ssh服務
1. #service ssh restart (註意:如果是centos7以下版本)
2.如果是centos7以上
查看ssh服務狀態:systemctl status sshd.service
開啟ssh服務:systemctl start sshd.service
重啟ssh服務:systemctl restart sshd.service
服務器自動開啟:systemctl enable sshd.service
六.xshell登錄
添加id_rsa私鑰文件,輸入建立私鑰時候的密碼,就成功了。
本文出自 “Note” 博客,轉載請與作者聯系!
centos配置私鑰登錄