Locked myself out of SSH on an Amazon EC2 box after fiddling with
ForceCommand internal-sftp in
/etc/ssh/sshd_config in order to allow
root log-in via SFTP.
SFTP still works fine, but PuTTY dies instantly, e.g:
The odd thing here is that SFTP still works fine and permits me to log-in as
root currently (because of the changes I made) - so I've got a WinSCP window open and I can trawl through whatever I like and edit stuff.
When I try to connect from another Linux box using:
ssh -i keyfile.pem email@example.com -p [portnumber]
I get the following response:
This service allows sftp connections only. Connection to [hostname] closed.
I've successfully removed
ForceCommand internal-sftp from
/etc/ssh/sshd_config but I'm having trouble running
service ssh restart remotely. When I do it from
sftp with the
! prefix, it says it's worked - but I can tell that it hasn't because the listening port is not changing.