権限が拒否されました(公開鍵)

権限が拒否されました(公開鍵)

サイトには同様の質問がいくつかありますが、私の問題を解決する質問が見つかりません。

適応ビットレートビデオストリーミングについていくつかの実験を行っており、FIPを持たない複数の(クライアント)ノードにアクセスできるようにするには(FIPを使用してSSH経由で接続できる)(サーバー)ノードが必要です。しかし、秘密鍵FTPを使用して私がサーバーに渡したものは同じです。

したがって、すべてのノードはキーを使用して作成されますmy_chameleon_key.pem。私とサーバーの間にリモート接続が確立されました。サーバーからクライアントにsshを試みると(ssh -i ~/.ssh/my_chameleon_key.pem -vT cc@<client_ip>ここで、server_ipはクライアントのIPアドレスリストからランダムに選択されます)、次の出力が表示されます。

OpenSSH_7.2p2 Ubuntu-4ubuntu2.10, OpenSSL 1.0.2g  1 Mar 2016
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to <server_ip> [<server_ip>] port 22.
debug1: Connection established.
debug1: key_load_public: No such file or directory
debug1: identity file /home/cc/.ssh/my_chameleon_key.pem type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/cc/.ssh/my_chameleon_key.pem-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.10
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.2p2 Ubuntu-4ubuntu2.10
debug1: match: OpenSSH_7.2p2 Ubuntu-4ubuntu2.10 pat OpenSSH* compat 0x04000000
debug1: Authenticating to <server_ip>:22 as 'cc'
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:QaA4NOIFUybFLYXHcbg8iHuGUw1Komvn+o4Mx5bdf14
debug1: Host '<server_ip>' is known and matches the ECDSA host key.
debug1: Found key in /home/cc/.ssh/known_hosts:1
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<rsa-sha2-256,rsa-sha2-512>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /home/cc/.ssh/my_chameleon_key.pem
debug1: Authentications that can continue: publickey
debug1: No more authentication methods to try.
Permission denied (publickey).

同様に、server_ipはクライアントIPです。

ls ~/.ssh出力を通じて、authorized_keys known_hosts my_chameleon_key.pem転送中にmy_chameleon_key.pemが変更されていないことを確認しました。

私は-vTトレースを調べる方法がわからないことがその一部であると確信していますが、ここでは完全に難しい状況です。この問題を解決するにはどうすればよいですか?

すべてのサーバーはCC-Ubuntu16.04です。これが有用な情報であれば、sudoで実行することは役に立ちません。追加情報を提供できる場合はお知らせください。

編集:この時点でいくつかのコマンドを実行したので、/var/log/auth.logがかなり詰まっていました。以下は(理論的に)私のSSHでなければならない最新の内容です。しかし、SSHを再試行しても更新されないので、わかりません。

Aug  8 15:47:16 mwhicks2abvsserver sshd[46351]: Accepted publickey for cc from 24.211.146.9 port 52223 ssh2: RSA SHA256:a6N6S9PllSObVyDZXJdG1GWUOkKhFTpIJ3Rae4sW8uQ
Aug  8 15:47:16 mwhicks2abvsserver sshd[46351]: pam_unix(sshd:session): session opened for user cc by (uid=0)
Aug  8 15:47:16 mwhicks2abvsserver systemd-logind[2861]: New session 8 of user cc.

また、ここに私の完全なauth.logファイルへのリンクがあります。ここに入れることを考えるには長すぎました。https://pastebin.com/vsyXD7bM

ベストアンサー1

まず、秘密鍵と公開鍵ファイルに正しい権限があることを確認します。 SSHはあまりにもオープンな権限が好きではありません。私は通常、公開鍵を含む.sshディレクトリにchmod 700を設定し、公開鍵と秘密鍵にchmod 600を設定しました。

私の場合、ユーザーとグループの名前を変更してホームディレクトリの名前を変更しましたが、ユーザー自身のホームディレクトリを変更するのを忘れてしまったため、この問題が発生しました。したがって、/ etc / passwd homeは依然として古いディレクトリを指しています。

おすすめ記事