1、SecureCRT設定
==========================================
Quick Connect-> Authentiation -> Public Key -> Properties ->Create Identity File ->
DSA/RSA -> Set Passphrase -> Done
完成時會在指定目錄生成兩個檔案,預設名稱為:私鑰Identity和公鑰Identity.pub。
2、SSH伺服器設定
如果不存在/root/.ssh目錄,則自行建立。
# mkdir /root/.ssh
# chmod 700 /root/.ssh
将公鑰Identity.pub傳到Linux伺服器,将SSH2相容格式的公鑰轉換成為Openssh相容格式。
# ssh-keygen -i -f Identity.pub >> /root/.ssh/authorized_keys
# chmod 600 /root/.ssh/authorized_keys
3、使用SecureCRT登入伺服器
首先設定登入模式為PublicKey,并選擇剛剛建立的公鑰檔案Identity.pub。
4、重新開機Linux伺服器的ssh服務
# service sshd restart
5、設定ssh配置檔案
為了安全建議隻使用密鑰登入,去掉預設的密碼登入。
# vi /etc/ssh/sshd_config
Protocol 2 //僅允許使用SSH2
PubkeyAuthentication yes //啟用PublicKey認證
AuthorizedKeysFile .ssh/authorized_keys //PublicKey檔案路徑
PasswordAuthentication no //禁止密碼驗證登入
使用Linux伺服器端生成類型為DSA、長度1024bits的公鑰檔案
ssh-keygen -t dsa -b 1024
//詢問passphrase的時候直接回車