標籤:伺服器 linux 遠程登入
使用xshell做密鑰驗證遠程登入linux:
我這裡用的工具:xshell 5 及 centos 6.5
首先在工具列選擇建立使用者密鑰產生嚮導,進行金鑰組產生操作
650) this.width=650;" src="http://s3.51cto.com/wyfs02/M02/5B/1B/wKiom1T--x6DkT2LAABv6XEGzwY781.jpg" title="1.jpg" alt="wKiom1T--x6DkT2LAABv6XEGzwY781.jpg" />
650) this.width=650;" src="http://s3.51cto.com/wyfs02/M00/5B/1B/wKiom1T--x7xcLIbAADdUddDcOs584.jpg" title="2.jpg" alt="wKiom1T--x7xcLIbAADdUddDcOs584.jpg" />
下一步
650) this.width=650;" src="http://s3.51cto.com/wyfs02/M01/5B/15/wKioL1T-_DyzMaSAAAFeVFVYZoc619.jpg" title="3.jpg" alt="wKioL1T-_DyzMaSAAAFeVFVYZoc619.jpg" />
產生公開金鑰對,下一步
650) this.width=650;" src="http://s3.51cto.com/wyfs02/M01/5B/1B/wKiom1T--x-Tj5gGAAGFuOWqxWA826.jpg" title="4.jpg" alt="wKiom1T--x-Tj5gGAAGFuOWqxWA826.jpg" />
這裡也可以直接點“完成”,這裡選“下一步”(原因看下一張圖)
650) this.width=650;" src="http://s3.51cto.com/wyfs02/M02/5B/15/wKioL1T-_DzROAFnAAExxNWXUKw847.jpg" title="5.jpg" alt="wKioL1T-_DzROAFnAAExxNWXUKw847.jpg" />
選中公開金鑰複製,保留,或者儲存為檔案,後面要用到
650) this.width=650;" src="http://s3.51cto.com/wyfs02/M02/5B/1B/wKiom1T--x_Do4YbAAIzTMn2Tsc501.jpg" title="6.jpg" alt="wKiom1T--x_Do4YbAAIzTMn2Tsc501.jpg" />
在伺服器端,儲存公開金鑰到伺服器,修改相關檔案
[[email protected]ost ~]# mkdir .ssh
[[email protected] ~]# vim .ssh/authorized_keys 將複製的公開金鑰粘貼到此檔案
修改許可權
[[email protected] ~]# chmod 600 .ssh/authorized_keys
[[email protected] ~]# chmod 700 .ssh
關閉selinux
[[email protected] ~]# setenforce 0 臨時修改
[[email protected] ~]# vim /etc/selinux/config
650) this.width=650;" src="http://s3.51cto.com/wyfs02/M01/5B/1B/wKiom1T_AoODgsR4AAFCg4sLb9s045.jpg" title="9.jpg" alt="wKiom1T_AoODgsR4AAFCg4sLb9s045.jpg" />
[[email protected] ~]# iptables -F 清空iptables
[[email protected] ~]# service iptables save
設定啟用密鑰登入
[[email protected] ~]# vim /etc/ssh/sshd_config
650) this.width=650;" src="http://s3.51cto.com/wyfs02/M02/5B/1B/wKiom1T_BOPhZd4_AALjTu7fqH4699.jpg" title="10.jpg" alt="wKiom1T_BOPhZd4_AALjTu7fqH4699.jpg" />
[[email protected] ~]# service sshd restart 重啟sshd
至此,設定xshell使用密鑰登入
650) this.width=650;" src="http://s3.51cto.com/wyfs02/M00/5B/1B/wKiom1T--yLgynUdAAHEvsECdqI942.jpg" title="8.jpg" alt="wKiom1T--yLgynUdAAHEvsECdqI942.jpg" />
xshell 使用密鑰驗證遠程登入linux