阿里云私鑰登陸

阿里云

在創建主機時候直接提供了私鑰公鑰,可以設置秘鑰對
不用配置服務端,好用

客戶端配置

chmod 400 xxx.pem
vi ~/.ssh/config

寫入

Host servicename
HostName 1.1.1.1
User root
IdentityFile ~/.ssh/xxx.pem

配置服務端教程(centos)

創建私鑰省略。。。

[root@host .ssh]$ vi /root/.ssh/authorized_keys
復制公鑰粘貼到/root/.ssh/authorized_keys
[root@host .ssh]$ chmod 600 /root/.ssh/authorized_keys
[root@host .ssh]$ chmod 700 /root/.ssh/

[root@host .ssh]$ vi /etc/ssh/sshd_config
設置私鑰登陸
RSAAuthentication yes
PubkeyAuthentication yes

留意 root 用戶能否通過 SSH 登錄:
PermitRootLogin yes

當你完成全部設置,并以密鑰方式登錄成功后,再禁用密碼登錄:
PasswordAuthentication no

最后,重啟 SSH 服務:
[root@host .ssh]$ service sshd restart
最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容