Results 1 to 8 of 8

Thread: Accidentally deleted ssh directory

  1. #1

    Default Accidentally deleted ssh directory

    Title.

    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.

    Thanks.

  2. #2
    Join Date
    Aug 2010
    Location
    Chicago suburbs
    Posts
    13,183
    Blog Entries
    3

    Default Re: Accidentally deleted ssh directory

    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.
    openSUSE Leap 15.1; KDE Plasma 5;
    testing Leap 15.2Alpha

  3. #3
    Join Date
    Jun 2010
    Location
    Michigan, USA
    Posts
    268

    Default Re: Accidentally deleted ssh directory

    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.
    If I am going to be spontaneous, I have to plan for it.

    www.CubicleNate.com

  4. #4
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    25,772

    Default Re: Accidentally deleted ssh directory

    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.
    Henk van Velden

  5. #5

    Default Re: Accidentally deleted ssh directory

    @hcvv:

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

    So did I really screwed my system?

  6. #6
    Join Date
    Jun 2008
    Location
    Auckland, NZ
    Posts
    20,841
    Blog Entries
    1

    Default Re: Accidentally deleted ssh directory

    Quote Originally Posted by F_style View Post
    @hcvv:

    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.

  7. #7
    Join Date
    Feb 2010
    Location
    Germany
    Posts
    2,752

    Smile Re: Accidentally deleted ssh directory

    Quote Originally Posted by F_style View Post
    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.
    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.
    Code:
         ~/.ssh/
                 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.

  8. #8

    Default Re: Accidentally deleted ssh directory

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

    Code:
    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 id_rsa.pub with 644

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •