歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> 關於Linux >> SecureCRT配置ssh key訪問linux的步驟

SecureCRT配置ssh key訪問linux的步驟

日期:2017/3/3 16:15:22   编辑:關於Linux

第一步,生成公鑰/密鑰對

使用SecureCRT的 工具->創建公鑰 即可,加密算法選擇RSA,因為sshd配置文件中選擇了RSA算法

這一步會生成兩個文件,默認是Identity和Identity.pub,其中Identity為密鑰,Identity.pub為公鑰。接下來的通行短語可以不輸入,不輸入的話登陸時不需要輸入通行短語。如果輸入了,登陸的時候會要求你輸入通行短語。

第二步,上傳Windows客戶機SecureCRT生成的公鑰Identity.pub到用戶目錄下.ssh文件夾中。注意上傳之前,一定要以ASCII格式上傳。

在用戶宿主目錄下

mkdir .ssh #在需要開啟ssh連接的用戶目錄下建立.ssh目錄

chmod 755 .ssh

ssh-keygen -i -f .ssh/Identity.pub>>.ssh/authorized_keys

chmod 644 .ssh/authorized_keys

第三步

vim /etc/ssh/sshd_config #修改ssh配置文件

(1) Protocol2 #僅允許使用SSH2

(2) Port22 #使用22端口

(3) PermitRootLoginyes #允許root登錄

(2) PubkeyAuthenticationyes #啟用公告密鑰配對認證方式

(3) AuthorizedKeysFile.ssh/authorized_keys

(4) RSAAuthenticationyes #允許RSA密鑰

(4) PasswordAuthenticationno #禁止密碼驗證登錄,如果啟用的話,OpenSSH的 RSA認證登錄就沒有意義了。

第三步,重新加載sshd服務,使用/etc/init.d/ssh restart即可

 

Copyright © Linux教程網 All Rights Reserved