Reputation: 1203
I configured my Raspberry Pi SSH-server to only accept ssh keys when logging in. Really clever I thought, until now.
The thing is, I've added a forced command for one key like this to authorized_keys
:
command="cd /home/pi/Sites/" ssh-rsa [bla bla bla] [my comment]
And when trying to log in now, it says just
Connection to MYSITE closed.
What I presume is that the forced command is being run and after that no interactive shell is being launched and therefore the connection is closed. Is there any way to connect anyway and undo the changes I've done to the authorized_keys
-file?
Upvotes: 1
Views: 368
Reputation: 25956
What I presume is that the forced command is being run and after that no interactive shell is being launched and therefore the connection is closed.
Exactly.
Is there any way to connect anyway and undo the changes I've done to the authorized_keys-file?
No. This is a feature. If you would be able to override this, it would be going around security policy that you defined (well ... this exactly does not make a lot of sense).
As already pointed out, if you don't have different authorized key, different user with authorized keys or passwords, you will have to get to the remote location and modify that file physically on the SD card.
For the next time, if you want to cd
to some directory and start interactive bash, you will need
command="cd /tmp/;bash" s
Upvotes: 1