<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                ## 前言 一般情況下,我們需要ssh連接遠程服務器,然后手動輸入密碼才能實現登錄,但我們在做某些遠程部署命令或者就是連接服務器時不希望每次都去查閱去輸入服務器密碼,尤其你密碼很多的時候。那么本文就給大家介紹下免輸入密碼的福利哦。 作為前提,大家都知道ssh連接并不是git連接項目時專屬的,它是連接服務器的一種通用協議,在github,gitlab的時候你也是通過吧自己的公鑰放在自己的ssh中實現的。(win系統有crt軟件,可以提供終端界面以及記錄密碼賬號功能,所以如果你有那個軟件可以忽略本教程) ## 服務器ssh的設置 ### 生成公鑰 生成公鑰與 私鑰的步驟與git中的相關教程完全一致.這里需要注意的是你對應的賬號設置是root@10.0.0.36 ~~~ //檢測是否生成配置了ssh key ssh -T git@github.com //如果已經配置好 Hi csnikey! You've successfully authenticated, but GitHub does not provide shell access. // 如果沒有配置好 Permission denied (publickey). fatal: The remote end hung up unexpectedly // 生成ssh key,如果你已經安裝了git cd ~/.ssh ssh-keygen -t rsa -C you@Email.com //遇到 提示一路 回車,遇到有Y 輸入Y(其中針對不同的代碼平臺,需要增加不用的ssh文件) //添加ssh key(如果提示你權限不夠,需要添加這個key,并同時注意必須切換到文檔根目錄下,~/.ssh下面) ssh-add id_rsa //若出現: Could not open a connection to your authenticationagent. ssh-agent bash //在使用 ssh-add id_rsa //登錄github.com --AccountSetting--ssh 點擊Add 將id_rsa.pub 文件中的 內容添加進去 ~~~ ### 公鑰移動到遠程服務器 #### 方式1 :代碼部署 ~~~ //傳到遠程也需要:賬號@host ssh-copy-id -i 36_id_rsa.pub root@10.0.0.36 //已經部署的 /usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "36_id_rsa.pub" /usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed /usr/bin/ssh-copy-id: WARNING: All keys were skipped because they already exist on the remote system. (if you think this is a mistake, you may want to use -f option) //沒有部署情況 /usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "36_id_rsa.pub" /usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed /usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys root@10.0.0.36's password: //部署成功提示: Number of key(s) added: 1 Now try logging into the machine, with: "ssh 'root@10.0.0.36'" and check to make sure that only the key(s) you wanted were added. ~~~ #### 方式2:遠程編輯 找到遠程目錄/root/.ssh/authorized_keys vm或者文件編輯,將本地的36_id_rsa.pub添加到key即可 ### 意外情況 如果提示你沒有權限修改,比如permission denied.需要你切換到對應的賬戶目錄,然后設置權限最高。 ~~~ chmod 777 /root/.ssh/authorized_keys //提出chmod沒有權限 chmod: 更改"authorized_keys" 的權限: 不允許的操作 //進一步設置 chattr chattr -i /etc/fstab ~~~ **說明:** chattr可以防止關鍵文件被修改,在linux下,有些配置文件是不允許任何人包括root修改的,為了防止被誤刪除或修改,可以設定該文件的"不可修改位(immutable)"。 ~~~ //不可以修改文件 chattr +i /etc/fstab //如果需要修改文件則: chattr -i /etc/fstab ~~~ ## 其他常識 ~~~ #連接某服務器 ssh xxx@host # 斷開連接 exit logout ~~~
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看