在windows端生成密鑰,客戶端鏈接是使用SecureCRTlinux
工具 –>建立公鑰windows
生成密鑰後,把公鑰文件複製到服務器端對應用戶家目錄的.ssh目錄下,文件名字爲authorized_keys,記住此權限給其爲400。服務器
把Identity.pub公鑰文件複製到服務器端ssh
若root家目錄下沒有.ssh目錄,在服務器端root家目錄下新建.ssh目錄工具
#mkdir .ssh.net
#cat Identity.pub >> .ssh/authorized_keysserver
#chmod –R 400 .sship
經過客戶端使用密鑰的方式進行登錄ci
Public-key authentication with the server for user sw failed. Please verify username and public/private key pair.get
此時selinux爲Enforcing,設置setenforce 0
#setenforce 0
再從新鏈接時,ok了
此時使用密鑰登錄就ok了