I accidentally untarred archive intended to be extracted in root directory, which among others included some files for /etc directory.
I went on to rm -rv ~/etc, but I quickly typed rm -rv /etc instead, and hit enter, while using a root account.

  • woelkchen@lemmy.world
    link
    fedilink
    arrow-up
    23
    arrow-down
    2
    ·
    9 days ago

    Your first mistake was attempting to unarchive to / in the first place. Like WTF. Why would this EVER be a sane idea?

    • u/lukmly013 💾 (lemmy.sdf.org)@lemmy.sdf.orgOP
      link
      fedilink
      English
      arrow-up
      12
      ·
      9 days ago

      I don’t know if it should be a bad thing. Inside the tar archive the configs were already organized into their respective dirctories, this way with --preserve-permissions --overwrite I could just quickly add the desired versions of configs.
      Some examples of contents:

      -rw-r--r-- root/root      2201 2026-02-18 08:08 etc/pam.d/sshd
      -rw-r--r-- root/root       399 2026-02-17 23:22 etc/pam.d/sudo
      -rw-r--r-- root/root      2208 2026-02-18 09:13 etc/sysctl.conf
      drwx------ user/user         0 2026-02-17 23:28 home/user/.ssh/
      -rw------- user/user       205 2026-02-17 23:29 home/user/.ssh/authorized_keys
      drwxrwxr-x user/user         0 2026-02-18 16:30 home/user/.vnc/
      -rw-rw-r-- user/user        85 2026-02-18 15:32 home/user/.vnc/tigervnc.conf
      -rw-r--r-- root/root      3553 2026-02-18 08:04 etc/ssh/sshd_config
      

      Keeps permissions, keeps ownership, puts things where they belong (or copies from where they were), and you end up with a single file that can be stored on whatever filesystem.

      • vapeloki@lemmy.world
        link
        fedilink
        arrow-up
        9
        ·
        9 days ago

        I assumed something like this. That’s a perfectly valid usecase for a tar extracted to /.

        But I love it how people always jump to the assumption that the one on the other end is the stupid one

    • SkaveRat@discuss.tchncs.de
      link
      fedilink
      arrow-up
      11
      ·
      9 days ago

      that was my reaction when I saw a coworker put random files and directories into / of a server

      I feel like some people don’t have a feeling about how a file system works

      • Trainguyrom@reddthat.com
        link
        fedilink
        English
        arrow-up
        2
        ·
        9 days ago

        Its a pretty common Windows server practice to just throw random shit on the root directory of the server. I’m guilty of this at times when there isn’t a better option available to me, but I at least use a dedicated directory at the root for dumping random crap and organize the files within that directory (and delete unneeded files when done) so that it doesn’t create more work later.

          • Trainguyrom@reddthat.com
            link
            fedilink
            English
            arrow-up
            2
            ·
            7 days ago

            Root’s home directory only works if you’re sshing in as root (not a great practice, although its certainly not as bad as on Windows thanks to key auth. You can simply revoke the keys of the admin you just let go rather than resetting a bunch of passwords). The reason its common practice in Windows Server administration is a combination of common practices: having dedicated admin accounts in AD for each administrator, Windows lacking a decent directory for content shared between users, and of course the general laziness that Windows administration attracts and fosters.

      • macniel@feddit.org
        link
        fedilink
        arrow-up
        1
        ·
        9 days ago

        Maybe they do and don’t fear the HFS? I mean do you use the HFS in a docker container?