2017-09-14 5 views
1

から公開鍵ファイルを削除して、エラーが、私はちょうど私がas suggestedを実行する公式gogsの/のgogs-RPIドッキングウィンドウの画像を使用して、ラズベリーPI3にGogs (Go Git Server)をインストールし、「アクセス許可が拒否されました」スロー私はラップトップを使用して、gogs webinterfaceを介して管理者ユーザーを登録し、アカウントに公開鍵を追加しました。私は今、このコマンドを使用して私のラップトップにPIからGitリポジトリのクローンを作成することができますGogsは、私は、クライアント

git clone ssh://[email protected]:10022/peter/my_repo.git 

私はキーフレーズを入力し、それだけで正常に動作します。

私のラップトップから公開鍵ファイル(id_rsa_gogs.pub)を削除して上記のコマンドを再度実行すると、「アクセス拒否」エラーが発生します。

誰でもそのことが分かりますか?私はすでにGogsに公開鍵を登録しました。 公開鍵をクライアントマシンに公開する必要があるのはなぜですか?私は、公開鍵がクライアントと一緒にいなければならないという事例は聞いたことがありません。

Udapte

私は.pubファイルのキーファイルをRMとssh -Tv [email protected] -p 10022 -i /home/peter/.ssh/id_rsa_gogsを実行した場合、私はこれを取得:

私が ssh -Tv [email protected] -p 10022を実行する場合に失敗するようだ
OpenSSH_7.2p2 Ubuntu-4ubuntu2.2, OpenSSL 1.0.2g 1 Mar 2016 
debug1: Reading configuration data /home/peter/.ssh/config 
debug1: Reading configuration data /etc/ssh/ssh_config 
debug1: /etc/ssh/ssh_config line 19: Applying options for * 
debug1: Connecting to 192.168.178.50 [192.168.178.50] port 10022. 
debug1: Connection established. 
debug1: key_load_public: No such file or directory 
debug1: identity file /home/peter/.ssh/id_rsa_gogs type -1 
debug1: key_load_public: No such file or directory 
debug1: identity file /home/peter/.ssh/id_rsa_gogs-cert type -1 
debug1: Enabling compatibility mode for protocol 2.0 
debug1: Local version string SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.2 
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.4 
debug1: match: OpenSSH_7.4 pat OpenSSH* compat 0x04000000 
debug1: Authenticating to 192.168.178.50:10022 as 'git' 
debug1: SSH2_MSG_KEXINIT sent 
debug1: SSH2_MSG_KEXINIT received 
debug1: kex: algorithm: [email protected] 
debug1: kex: host key algorithm: ecdsa-sha2-nistp256 
debug1: kex: server->client cipher: [email protected] MAC: <implicit> compression: none 
debug1: kex: client->server cipher: [email protected] MAC: <implicit> compression: none 
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY 
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:[REMOVED] 
debug1: Host '[192.168.178.50]:10022' is known and matches the ECDSA host key. 
debug1: Found key in /home/peter/.ssh/known_hosts:18 
debug1: rekey after [REMOVED] blocks 
debug1: SSH2_MSG_NEWKEYS sent 
debug1: expecting SSH2_MSG_NEWKEYS 
debug1: rekey after [REMOVED] blocks 
debug1: SSH2_MSG_NEWKEYS received 
debug1: SSH2_MSG_EXT_INFO received 
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,ssh-rsa,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521> 
debug1: SSH2_MSG_SERVICE_ACCEPT received 
debug1: Authentications that can continue: publickey,keyboard-interactive 
debug1: Next authentication method: publickey 
debug1: Trying private key: /home/peter/.ssh/id_rsa_gogs 
Enter passphrase for key '/home/peter/.ssh/id_rsa_gogs': 
debug1: Authentication succeeded (publickey). 
Authenticated to 192.168.178.50 ([192.168.178.50]:10022). 
debug1: channel 0: new [client-session] 
debug1: Requesting [email protected] 
debug1: Entering interactive session. 
debug1: pledge: network 
debug1: client_input_global_request: rtype [email protected] want_reply 0 
debug1: Remote: Forced command. 
debug1: Remote: Port forwarding disabled. 
debug1: Remote: X11 forwarding disabled. 
debug1: Remote: Agent forwarding disabled. 
debug1: Remote: PTY allocation disabled. 
debug1: Sending environment. 
debug1: Sending env LC_TELEPHONE = de_DE.UTF-8 
debug1: Sending env LANG = en_US.UTF-8 
debug1: Sending env LC_NAME = de_DE.UTF-8 
debug1: Sending env LC_MEASUREMENT = de_DE.UTF-8 
debug1: Sending env LC_IDENTIFICATION = de_DE.UTF-8 
debug1: Sending env LC_MONETARY = de_DE.UTF-8 
debug1: Sending env LC_PAPER = de_DE.UTF-8 
debug1: Sending env LC_ADDRESS = de_DE.UTF-8 
debug1: Sending env LC_NUMERIC = de_DE.UTF-8 
Hi there, You've successfully authenticated, but Gogs does not provide shell access. 
If this is unexpected, please log in with password and setup Gogs under another user. 
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0 
debug1: client_input_channel_req: channel 0 rtype [email protected] reply 0 
debug1: channel 0: free: client-session, nchannels 1 
Transferred: sent 3268, received 3096 bytes, in 0.2 seconds 
Bytes per second: sent 15416.0, received 14604.6 
debug1: Exit status 0 

(ノー直接キーファイルを指定する):

OpenSSH_7.2p2 Ubuntu-4ubuntu2.2, OpenSSL 1.0.2g 1 Mar 2016 
debug1: Reading configuration data /home/peter/.ssh/config 
debug1: Reading configuration data /etc/ssh/ssh_config 
debug1: /etc/ssh/ssh_config line 19: Applying options for * 
debug1: Connecting to 192.168.178.50 [192.168.178.50] port 10022. 
debug1: Connection established. 
debug1: key_load_public: No such file or directory 
debug1: identity file /home/peter/.ssh/id_rsa type -1 
debug1: key_load_public: No such file or directory 
debug1: identity file /home/peter/.ssh/id_rsa-cert type -1 
debug1: key_load_public: No such file or directory 
debug1: identity file /home/peter/.ssh/id_dsa type -1 
debug1: key_load_public: No such file or directory 
debug1: identity file /home/peter/.ssh/id_dsa-cert type -1 
debug1: key_load_public: No such file or directory 
debug1: identity file /home/peter/.ssh/id_ecdsa type -1 
debug1: key_load_public: No such file or directory 
debug1: identity file /home/peter/.ssh/id_ecdsa-cert type -1 
debug1: key_load_public: No such file or directory 
debug1: identity file /home/peter/.ssh/id_ed25519 type -1 
debug1: key_load_public: No such file or directory 
debug1: identity file /home/peter/.ssh/id_ed25519-cert type -1 
debug1: Enabling compatibility mode for protocol 2.0 
debug1: Local version string SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.2 
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.4 
debug1: match: OpenSSH_7.4 pat OpenSSH* compat [REMOVED] 
debug1: Authenticating to 192.168.178.50:10022 as 'git' 
debug1: SSH2_MSG_KEXINIT sent 
debug1: SSH2_MSG_KEXINIT received 
debug1: kex: algorithm: [email protected] 
debug1: kex: host key algorithm: ecdsa-sha2-nistp256 
debug1: kex: server->client cipher: [email protected] MAC: <implicit> compression: none 
debug1: kex: client->server cipher: [email protected] MAC: <implicit> compression: none 
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY 
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:[REMOVED] 
debug1: Host '[192.168.178.50]:10022' is known and matches the ECDSA host key. 
debug1: Found key in /home/peter/.ssh/known_hosts:[REMOVED] 
debug1: rekey after [REMOVED] blocks 
debug1: SSH2_MSG_NEWKEYS sent 
debug1: expecting SSH2_MSG_NEWKEYS 
debug1: rekey after [REMOVED] blocks 
debug1: SSH2_MSG_NEWKEYS received 
debug1: SSH2_MSG_EXT_INFO received 
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,ssh-rsa,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521> 
debug1: SSH2_MSG_SERVICE_ACCEPT received 
debug1: Authentications that can continue: publickey,keyboard-interactive 
debug1: Next authentication method: publickey 
debug1: Trying private key: /home/peter/.ssh/id_rsa 
debug1: Trying private key: /home/peter/.ssh/id_dsa 
debug1: Trying private key: /home/peter/.ssh/id_ecdsa 
debug1: Trying private key: /home/peter/.ssh/id_ed25519 
debug1: Next authentication method: keyboard-interactive 
debug1: Authentications that can continue: publickey,keyboard-interactive 
debug1: No more authentication methods to try. 
Permission denied (publickey,keyboard-interactive). 

同じ問題が発生しているかどうかを確認するパスフレーズなしでssh鍵を登録して使用する。

結果はパスフレーズなしの場合と同じです。

それが重要かどうかはわからないが、私は~/.ssh/configの内側にこれを持ってGogs

Host 192.168.178.50:10022 
    HostName 192.168.178.50:10022 
    IdentityFile ~/.ssh/id_rsa_gogs 
    User Peter 

答えて

2
Host 192.168.178.50:10022 
    HostName 192.168.178.50:10022 
    IdentityFile ~/.ssh/id_rsa_gogs 
    User Peter 

sshはここHostまたはHostnameオプションのいずれかの一部としてポート番号を受け付けません。その結果、このエントリが接続試行に適用され、IDファイルまたはユーザーが適用されないことを認識していません。あなただけのIPアドレスと一致する必要がある場合は

、この作業をする必要があります:あなたは本当にポートに一致する必要がある場合は

Host 192.168.178.50 
    Port 10022 
    IdentityFile ~/.ssh/id_rsa_gogs 
    User Peter 

が、これは動作するはずです:

Match host 192.168.178.50 exec "test %p = 10022" 
    IdentityFile ~/.ssh/id_rsa_gogs 
    User Peter 

これはtestを実行しますコマンドを使用してポート値をテストします。 "%p"は、sshがそのポイントまで使用するポートの値(デフォルトの22またはコマンドラインからの値)に置き換えられます。テストは[;これは主にif文の一部としてシェルスクリプトで使用されるコマンドラインユーティリティです。

1

ため、実際のエラーを引き起こしているかを理解するために、ssh -Tv [email protected] -p 10022 -i /home/peter/.ssh/id_rsa_gogsを試してみてください。

を登録して使用するときに同じ問題が発生した場合は、のパスフレーズも確認してください。 (たとえpublic keys don't have the passphrase

+0

ありがとうございます!私は質問を更新しました。 – Rotareti

+0

@Rotareti '/ home/peter/.ssh/config'の名前を変更して、デフォルトのid_rsaキーが選択されているかどうか確認してください。 – VonC

+0

'mv config back_config'の後も状況は変わりません。 'ssh -Tv'出力だけがその後に行2と行3を表示しません。 – Rotareti

関連する問題