Accidentally deleted ssh directory


I’m using GNOME desktop.
I had heard that deleting some of home’s hidden directories such as .config, .local, etc lead to all class of problems and breaking in the desktop or the whole user.
Today I accidentally deleted my ~/.ssh directory. Even though I always keep its contents empty after using ssh sessions, I feel a bit uneasy whether .ssh directory created by openSUSE installation by default could be different of the one I manually create.
Even though I created it back just by logging in a remote server with ssh and letting .ssh to be created.

I don’t know what permissions openSUSE installer gives by default to home directories, or if it gives them other “special” features such as the selinux dot ‘.’ at the end of permissions, just like Centos.

I apologize beforehand for yet another question like this, but, I would appreciate very much if you could help me again. Even though I have been trying to work on this, I still need someone’s help to stay relatively easy.

Please again.


As far as I know, openSUSE doesn’t create the “.ssh” directory. I’ve always had to create it myself.

As long as it cannot be written by group or others, you should be fine. I am seeing “drwxr-xr-x” for the permissions. Some folk are more restrictive, and don’t allow anything for group or others.

Once you use ssh, the system will create the .ssh directory in your home folder. Deleting the folder and its contents only removes the stored keys and such things.

And of course, just restoring it from your latest backup (or, as an alternative, looking in that backup what the permissions were) is the most easy.


I do backups, but I have no backup of that directory!

So did I really screwed my system?

No, it’s just a user configuration as has already been pointed out to you, but it does suggest you’re not backing up as completely as you possibly think you were.

AFAIK, the ‘~/.ssh/’ directory is not added by default to new user’s home directories: it ain’t in ‘/etc/skel/’ . . .

I’ve personally never had to create the thing manually; AFAICS ‘ssh’ creates the thing if it ain’t there; there doesn’t seem to be an ‘ssh’ option to place the ‘~/.ssh/’ directory somewhere else; only options to select the ‘config’ and ‘identity’ files are mentioned; and, an environment variable to move the ‘~/.ssh/’ directory somewhere else also doesn’t seem to be present.

             This directory is the default location for all user-specific configuration and authentication informa-
             tion.  There is no general requirement to keep the entire contents of this directory secret, but the
             recommended permissions are read/write/execute for the user, and not accessible by others.

easiest way to create .ssh and default keys with proper perms is by running

ssh-keygen -t rsa -b 4096

then follow the interactive questions, ie hit ENTER several times. You will see that .ssh dir is created with 700, id_rsa with 600 and with 644