権限が拒否されました(公開キー、gssapi-keyex、gssapi-with-mic)Amazon Linux

権限が拒否されました(公開キー、gssapi-keyex、gssapi-with-mic)Amazon Linux

この問題に関する他の質問を見ましたが、それらのどれも私には役に立ちませんでした。

Amazon Linuxを実行しているEC2インスタンスに新しいユーザーを追加するには、次の手順を実行しました。

sudo usermod -G git_group rich
sudo mkdir -p /home/rich/.ssh
sudo mkdir /home/rich/.ssh/authorized_keys
sudo chown root:root /home/rich
sudo chown -R rich:rich /home/rich/
sudo chmod 700 /home/rich/.ssh
sudo chmod 700 /home/rich/.ssh/authorized_keys

sudo su rich

cd ~/.ssh
ssh-keygen -a 100 -b 4096 -C "" -E sha256 -o -t rsa
 < no passwords >
cp id_rsa.pub ./authorized_keys

リモートシステムでsftpを介してキーを取得し、/home/my_user/.sshに配置し、両方に対してchmod 600権限があることを確認しました。

その後、.ssh / configにエントリを追加しました。

User rich
IdentityFile = ~/.ssh/rich_private_key

私が試したとき

ssh -vvv [email protected]

私は得る:

No Kerberos credentials available (default cache: FILE:/tmp/krb5cc_1000)

debug2: we did not send a packet, disable method
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /home/my_user/.ssh/rich_private_key
debug3: sign_and_send_pubkey: RSA xxx
debug3: send packet: type 50
debug2: we sent a publickey packet, wait for reply
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic
debug2: we did not send a packet, disable method
debug1: No more authentication methods to try.
[email protected]: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).

私が何を見逃しているのか知っていますか?また、sshd_configにPubkeyAuthentication yesを追加して再起動しましたが、役に立たなかったようです。

ベストアンサー1

1行に1つのキーを持つファイルではなく、Authorized_keysをキーを含むディレクトリ(間違った)にし、問題が解決しました。

おすすめ記事