On a server I have a public key auth only for root account. Is there any point of logging in with a different account?

  • Its a concept called defense in depth. Without root login now you require the key AND sudo password.

    Also, outside of self hosted you will have multiple people logging in. You want them to log in with their own users for logging and permission management.

      • ☂️-
        link
        fedilink
        2
        edit-2
        3 days ago

        you would need 2 different exploits for 2 different types of attack though.

        its always good to have an extra layer of “oh shit i need another exploit”. unless your threat modelling includes nation-states, that is.

          • @Lemmchen@feddit.org
            link
            fedilink
            English
            10
            edit-2
            4 days ago

            How did the attacker gain your user’s privileges? Malware-infected user installation? A vulnerability in genuine software running as your user? In most scenarios these things only become worse when running as root instead.

            • @ShortN0te@lemmy.ml
              link
              fedilink
              64 days ago

              The scenario OC stated is that if the attacker has access to the user on the server then the attacker would still need the sudo password in order to get root privileges, contrary to direct root login where the attack has direct access to root privileges.

              So, now i am looking into this scenario where the attack is on the server with the user privileges: the attacker now modifies for example the bashrc to alias sudo to extract the password once the user runs sudo.

              So the sudo password does not have any meaningful protection, other then maybe adding a time variable which is when the user accesses the server and runs sudo

            • SavvyWolf
              link
              fedilink
              English
              04 days ago

              I don’t think that actually works; the attacker could just remove .bashrc and create a new file with the same name.

      • @markstos@lemmy.world
        link
        fedilink
        43 days ago

        This was downvoted, but is a good question.

        If your account is compromised, the shell init code could be modified to install a keylogger to discover the root password. That’s correct.

        Still, that capture doesn’t happen instantly. On a personal server, it could be months until the owner logs in next. On a corporate machines, there may be daily scans for signs of intrusion, malware, etc. Either way, the attacker has been slowed down and there is a chance they won’t succeed in a timeframe that’s useful to them.

        It’s perhaps like a locking a bike: with right tool and enough time, a thief can steal the bike. Sometimes slowing them down sufficiently is enough to win.