tl;dr
/etc/ssh/sshd_config
でPermitRootLoginをyesにしてsshdを再起動する~root/.ssh/authorized_keys
に記載されている,command="echo 'Please login as the user \"ec2-user\" rather than the user \"root\".';echo;sleep 10"
を消す
経緯など
SSHでrootユーザが直接ログインする是非は置いておいて、PermitRootLoginをyesにするだけでrootログインできると思いきや ssh接続時にエラーメッセージが出てしまった。
$ ssh -i path/to/key root@foobarbaz Please login as the user "ec2-user" rather than the user "root". $
少し調べたところauthorized_keysにcommandオプションが指定されていたのでこれを消すと回避できた。
そもそもauthorized_keysにこんなオプションがあるのを知らなかったので勉強になった
man pageのAUTHORIZED_KEYS FILE FORMAT
の項にいろいろ載ってた。
これを使うとssh時の操作ログ取りを仕込んだりできそう