Skip to Content

ERROR: AuthorizedKeysCommand /usr/share/ec2-instance-connect/eic_run_authorized_keys username SHA256:ecphulTPPp7xHnSCVkuQH2fcXemYKjT8xFftheRDz+s failed, status 22

How to solve: AuthorizedKeysCommand /usr/share/ec2-instance-connect/eic_run_authorized_keys username SHA256:ecphulTPPp7xHnSCVkuQH2fcXemYKjT8xFftheRDz+s failed, status 22.

1. This issue occurs entirely on the EC2 instance. It can be resolved by removing the relevant package using the below command

root@server ~]# apt-get remove ec2-instance-connect

2. Restart SSH and also ensure that systemd is aware of any changes in its configuration files

root@server ~]# systemctl restart ssh
root@server ~]# systemctl daemon-reload

Additionally, there is a configuration file at '/usr/lib/systemd/system/ssh.service.d/ec2-instance-connect.conf' associated with this process.