プロが教える店舗&オフィスのセキュリティ対策術

AWSでSSH接続をしたいのですが、どうしてもエラーで弾かれてしまいます。いくつかサイトを参考にトライしたのですが原因が解明できません!!何がおかしいのでしょうか!?!???!

以下MacBookAirのターミナルにて実行

Last login: Wed Nov 8 11:29:16 on ttys000
user@userMacBook-Air ~ % cd /Users/user/Desktop/Desktop/HP/ssh
user@userMacBook-Air ssh % chmod 0600 /Users/user/Desktop/Desktop/HP/ssh/abc.pem
user@userMacBook-Air ssh % ssh -i /Users/user/Desktop/Desktop/HP/ssh/abc.pem ec2-user@ec2-〇〇-〇〇-〇〇〇-〇〇〇.ap-northeast-1.compute.amazonaws.com
/Users/user/.ssh/config line 6: keyword identityfile extra arguments at end of line
/Users/usr/.ssh/config: terminating, 1 bad configuration options
user@userMacBook-Air ssh ssh %

コンフィグファイルの6行目の秘密鍵のパスはパスのコピーで移してますし、どこか間違えているから分かる方お願い致します!!!!

参考サイト

EC2 インスタンスにアクセスしようとすると、「Permission denied (publickey)」または「Authentication failed, permission denied」というエラーが表示されます。これを解決するにはどうすればよいですか?
https://repost.aws/ja/knowledge-center/ec2-linux …


AWS EC2 に SSH 接続できない・繋がらないときの確認項目
https://xn--o9j8h1c9hb5756dt0ua226amc1a.com/?p=3 … 

独学ではじめてAWSのEC2にデプロイする方法④(EC2インスンタンスにSSHログイン)
https://qiita.com/gyu_outputs/items/fc4f6e548649 …

A 回答 (2件)

お役には立てませんがssh実行時にオプション"-v"/"-vv"/"-vvv"を付けることでデバッグ情報がたくさん表示されます。

不具合解消の一助となるかもしれません。
"-vvv"では死ぬほどメッセージが表示されます。

PS C:\Users\kxxxxxxo\Desktop> ssh -vvv Txxxxxo@17xxxxxxxx7
OpenSSH_for_Windows_8.6p1, LibreSSL 3.4.3
debug3: Failed to open file:C:/Users/kxxxxx/.ssh/config error:2
debug3: Failed to open file:C:/ProgramData/ssh/ssh_config error:2
debug2: resolve_canonicalize: hostname 17xxxxxxxx7 is address
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> 'C:\\Users\\xxxx/.ssh/known_hosts'
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> 'C:\\Users\\xxxx/.ssh/known_hosts2'
debug1: Authenticator provider $SSH_SK_PROVIDER did not resolve; disabling
debug3: ssh_connect_direct: entering
debug1: Connecting to 17xxxxxxxx7 []17xxxxxxxx7 port 22.
debug1: Connection established.
debug3: Failed to open file:C:/Users/kxxxxxxo/.ssh/id_rsa error:2
debug3: Failed to open file:C:/Users/kxxxxxxo/.ssh/id_rsa.pub error:2
debug3: failed to open file:C:/Users/kxxxxxxo/.ssh/id_rsa error:2
debug1: identity file C:\\Users\\kxxxxxxo/.ssh/id_rsa type -1
debug3: Failed to open file:C:/Users/kxxxxxxo/.ssh/id_rsa-cert error:2
debug3: Failed to open file:C:/Users/kxxxxxxo/.ssh/id_rsa-cert.pub error:2
debug3: failed to open file:C:/Users/kxxxxxxo/.ssh/id_rsa-cert error:2
debug1: identity file C:\\Users\\kxxxxxxo/.ssh/id_rsa-cert type -1
debug3: Failed to open file:C:/Users/kxxxxxxo/.ssh/id_dsa error:2
debug3: Failed to open file:C:/Users/kxxxxxxo/.ssh/id_dsa.pub error:2
debug3: failed to open file:C:/Users/kxxxxxxo/.ssh/id_dsa error:2
    • good
    • 0

>config line 6: keyword identityfile extra arguments at end of line


identityfile行におけるファイル指定の記述が不正なのだと。
誰か有識者に直接configファイルを見てもらっては。

Linuxで試した例:
debian:~/.ssh$ ssh -V
OpenSSH_9.2p1 Debian-2+deb12u1, OpenSSL 3.0.11 19 Sep 2023
----------------------------------------------------------------
debian:~/.ssh$ cat -n config
1 Host me
2 hostname localhost
3 identityfile id_rsa.key a test

debian:~/.ssh$ ssh me
/home/osamu/.ssh/config line 3: keyword identityfile extra arguments at end of line
/home/osamu/.ssh/config: terminating, 1 bad configuration options
----------------------------------------------------------------
debian:~/.ssh$ cat config
Host me
hostname localhost
identityfile id_rsa.key

debian:~/.ssh$ ssh me
The authenticity of host 'localhost (::1)' can't be established.
ED25519 key fingerprint is SHA256:(snip)
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? ^C
debian:~/.ssh$
    • good
    • 0

お探しのQ&Aが見つからない時は、教えて!gooで質問しましょう!

このQ&Aを見た人はこんなQ&Aも見ています


このQ&Aを見た人がよく見るQ&A