兩種方法:linux
方法一:用linux內置rsa建立祕鑰sql
方法二:用CRT客戶端,生成祕鑰vim
方法一:centos
一、使用 rsa 生成密鑰dom
[root@centos6 ~]# ssh-keygen ##生成密鑰命令
Generating public/private rsa key pair. ##生成密鑰(私鑰/公鑰)對 Enter file in which to save the key (/root/.ssh/id_rsa): ##保存到/root/.ssh/id_rsa直接回車 Enter passphrase (empty for no passphrase): ##輸入密鑰密碼 Enter same passphrase again: ##再次輸入 Your identification has been saved in /root/.ssh/id_rsa. ##你的私鑰存在/root/.ssh/id_rsa Your public key has been saved in /root/.ssh/id_rsa.pub. ##你的公鑰存在/root/.ssh/id_rsa.pub The key fingerprint is: b2:19:2d:10:fe:8a:2f:f0:e9:05:ec:da:fc:93:ad:74 root@centos6.8 The key's randomart p_w_picpath is: +--[ RSA 2048]----+ | . | | . . | | o | | . o . | | o = S | |.. o . * | | oo.+oE | | +++o.. | |..+o+o | +-----------------+
建立touch authorized_keys文件,用於存放公鑰,並把剛生成的公鑰放入ssh
[root@centos6 .ssh]#
將生成的私鑰放到本地ide
二、設置 ssh 驗證模式spa
[root@centos6 ~]# vim /etc/ssh/sshd_config 去掉這三個的註釋 RSAAuthentication yes ##是否使用純的 RSA 認證 PubkeyAuthentication yes ##是否容許 Public Key? AuthorizedKeysFile .ssh/authorized_keys ##設定若要使用不須要密碼登入的帳號時,那麼那個帳號的存放檔案所在檔名! 將如下三個參數改爲no ##防止用密碼登錄 ChallengeResponseAuthentication no ##挑戰任何的密碼認證 PasswordAuthentication no ##密碼驗證 UsePAM no ##這樣能夠加快鏈接,不要驗證DNS
三、重啓sshd服務rest
[root@centos6 ~]# service sshd restart
四、鏈接orm
提示:使用遠程鏈接客戶端CRT鏈接時,必需要密鑰纔可登錄
這時找到crt 128屬性 鑑權
選擇公鑰 ->屬性
選擇使用會話公鑰設置
證書選擇第一步下載到本機的私鑰 ->肯定便可
5.登錄成功
方法二:
一、生成祕鑰
通行密碼就是之後要用的密鑰密碼
記住路徑
二、私鑰按照
這時找到crt 128屬性 鑑權
選擇公鑰 ->屬性
選擇使用會話公鑰設置(這裏的路徑是D:\Documents、Identity)
證書選擇第一步下載到本機的私鑰 ->肯定便可
三、公鑰放到authorized_keys內
四、鏈接