久久青草精品A片狠狠,日韩欧美视频一区二区,亚洲国码AV日韩,国产精品黄在

創(chuàng)建SSH密鑰對(duì)

2019-01-03 23:54:37 16840

使用限制

SSH密鑰對(duì)僅支持Linux系統(tǒng)創(chuàng)建。

創(chuàng)建SSH密鑰操作步驟

  1. 使用VNC服務(wù)器賬號(hào)密碼連接Linux實(shí)例。

  2. 打開(kāi)終端,輸入以下指令,查看是否已經(jīng)生成SSH秘鑰。


    如果有文件id_rsa.pub 或 id_dsa.pub 說(shuō)明已經(jīng)創(chuàng)建過(guò)SSH密鑰,導(dǎo)入即可。

    1. ls -al ~/.ssh

    2. # Lists the files in your .ssh directory, if they exist

  3. 生成新的SSH密鑰。

    在服務(wù)器上制作密鑰對(duì)。首先用密碼登錄到你打算使用密鑰登錄的賬戶,然后執(zhí)行以下命令:


    1. [root@host ~]$ ssh-keygen <== 建立密鑰對(duì)

    2. Generating public/private rsa key pair.

    3. Enter file in which to save the key (/root/.ssh/id_rsa): <==  Enter

    4. Created directory '/root/.ssh'.

    5. Enter passphrase (empty for no passphrase): <== 輸入密鑰鎖碼,或直接按 Enter 留空

    6. Enter same passphrase again: <== 再輸入一遍密鑰鎖碼

    7. Your identification has been saved in /root/.ssh/id_rsa. <== 私鑰

    8. Your public key has been saved in /root/.ssh/id_rsa.pub. <== 公鑰

    9. The key fingerprint is: xxxxxxx

  4. 創(chuàng)建完成,安裝公鑰。

    輸入以下命令,在服務(wù)器上安裝公鑰:


    如此便完成了公鑰的安裝。為了確保連接成功,請(qǐng)保證以下文件權(quán)限正確:


    1. [root@host .ssh]$ chmod 600 authorized_keys

    2. [root@host .ssh]$ chmod 700 ~/.ssh

    3. [root@host ~]$ cd .ssh

    4. [root@host .ssh]$ cat id_rsa.pub >> authorized_keys

  5. 設(shè)置SSH,打開(kāi)密鑰登錄。

    編輯 /etc/ssh/sshd_config 文件,進(jìn)行如下設(shè)置:


    另外,請(qǐng)留意 root 用戶能否通過(guò) SSH 登錄:


    當(dāng)你完成全部設(shè)置,并以密鑰方式登錄成功后,再禁用密碼登錄:


    最后,重啟 SSH 服務(wù):


    1. [root@host .ssh]$ service sshd restart

    2. PasswordAuthentication no

    3. PermitRootLogin yes

    4. RSAAuthentication yes

    5. PubkeyAuthentication yes


    提交成功!非常感謝您的反饋,我們會(huì)繼續(xù)努力做到更好!

    這條文檔是否有幫助解決問(wèn)題?

    非常抱歉未能幫助到您。為了給您提供更好的服務(wù),我們很需要您進(jìn)一步的反饋信息:

    在文檔使用中是否遇到以下問(wèn)題: