2016-02-27 161 views
2

我想登錄我的服務器沒有密碼,我已經在服務器本地主機上成功,但我嘗試從我的mac專業版登錄失敗。無密碼SSH登錄

首先,我測試的服務器上。

  1. 第1步:生成密鑰 enter image description here

  2. 步驟2:貓的authorized_keys文件,並嘗試無密碼SSH登錄本地主機,是沒有問題的。 enter image description here

所以,我試試這個對我的Mac Pro

  • 第3步:生成密鑰 enter image description here

  • 第4步:公鑰我的服務器,和貓複製到authorized_keys的 enter image description here

  • 步驟5:嘗試登錄到我的服務器上我的Mac Pro,仍需要密碼 enter image description here

  • 步驟6:我谷歌「無密碼SSH登錄」,並找到了SSH說,該文件名爲authorized_keys的應該有權限600 &〜/ .ssh目錄一般應具有權限700。所以,我做以下步驟 enter image description here

  • 第7步:仍需要密碼 enter image description here

  • 有人可以幫助這個問題?我的Mac是OS X 10.11,我的服務器是CentOS的7.0 64位


    更新:

    1. 的配置是的authorized_keys enter image description here
    +0

    查看ssh配置,如果使用'authorized_keys'而不''authorized_keys2' –

    +0

    我檢查配置,使用authorized_keys – user2655973

    +3

    客戶端計算機上包含您的密鑰的文件名是什麼?如果它不是'id_dsa'(默認),那麼你需要用選項'-i '發出你的ssh(或者在'〜/ .ssh/config'中配置它)。 – rhashimoto

    回答

    0

    你的過程似乎罰款,但對於MAC你似乎錯過了一個關鍵步驟;

    sudo systemsetup -setremotelogin on 
    

    您需要配置MAC以通過setremotelogin接受遠程登錄,如上所述。

    0

    我發現,RHEL 7和SELinux的是根本原因,即使在/ etc/SSH/sshd_config中調整每一個變量,比鎖匠使更多的鍵後。以root用戶身份登錄,並運行以下命令:

    setsebool -P use_nfs_home_dirs 1 
    

    您仍然必須創建密鑰,並與其他主機登錄名共享密鑰。我的問題是我們使用的是基於NFS的「home」目錄,所以SELinux不允許沒有這個明確標誌的訪問。

    讓我知道你的問題是否消失。