0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

AWS CodeCommitにSSH接続しようとしたら"Permission denied (publickey)"になった件

Posted at

課題

AWS CodeCommitにRepositoryを立てて、サクッとSourceを共有しようとしたら、予想外にハマった件。
接続元は、Fedora34 Workstation.

[root@ip-***-***-***-*** ~]# ssh -T A******************D@git-codecommit.us-east-1.amazonaws.com
sign_and_send_pubkey: no mutual signature supported
A******************D@git-codecommit.us-east-1.amazonaws.com: Permission denied (publickey).

原因

詳細はよく分からないが、最近のOpenSSHは古い暗号化形式を拒否するらしい
これ、昔から使ってるSSH Private Keyを使って最新のAmazon LinuxのEC2に接続しようとするときにもたまに起こる。

対応方法

/etc/ssh/ssh_configに以下を追記する。

Include /etc/ssh/ssh_config.d/*.conf
PubkeyAcceptedKeyTypes +ssh-dss    # <= 追記

~/.ssh/configに個別に記述する方法もあるけど、意外とハマりがちなので特別な理由がないなら ssh_configに記述した方がSmartっぽい。

結果

SSH接続できるようになる。

# ssh -T A******************D@git-codecommit.us-east-1.amazonaws.com
You have successfully authenticated over SSH. You can use Git to interact with AWS CodeCommit. Interactive shells are not supported.Connection to git-codecommit.us-east-1.amazonaws.com closed by remote host.

もちろん、Git cloneも上手く行く。

# git clone ssh://A******************D@git-codecommit.us-east-1.amazonaws.com/v1/repos/*** 
Cloning into '***'...
warning: You appear to have cloned an empty repository.

その他

CodeCommitを利用するIAM UserにはMFAを有効にしない方が良いっぽい。
どうしても有効にする必要がある場合には、こことかここを参考にすると良さそう。

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?