rm -r ~/ deletes public key


After I used rm -r ~/ to delete the temporary files inside my remote home directory, I can’t login through ssh any more. Error message: ssh permission denied (publickey)


Lots of config files are put under user’s home directory, use ls -a to display these invisible config files.

Public keys are put under .ssh. By deleting all the files under home directory, I also cut down my own access to login again.


  1. Don’t use rm -r ~/, it’s a very risky command. You will delete all of your keys and configs with this command. To make things worse, it’s possible to delete the /root with admin permission using this command.
  2. Delete exact files instead, avoid –recrusive option. Or use -i to review the files to be deleted one by one.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s