Ssh – use switch user “su” with keys / certificate

certificatesshssh-keys

I just locked myself out of SSH. Basically, I added three users to /etc/ssh/sshd_config using the AllowUsers directive, which is great because now they can login, but now I can't, and I'm the only user on the sudoers list.

I would happily do an "su" from within an SSH session of one of those users I just added, but I do not have the password for my account, only a .pem certificate file.

Best Answer

Nope, won't work. Best bet: reboot your (remote?) machine into recovery mode if this is possible and modify the configuration then. And an advice for the future: keep an existing shell open and try to re-login with your existing account in a new session before terminating (no offense meant).