Obviously it's widely recommended not to log in directly as a superuser account, but I'm curious.

What is the flag or setting that FreeBSD uses to recognise those accounts that automatically gain su privilege on login, without the user executing any login script or extra privilege-escalation command?

  • O.o su logs in as uid 0 unless you tell it otherwise, and you're asking why logging in as uid 0 logs in as uid 0 without having to use su? – muru Nov 8 at 11:07

The “setting” is that root and toor have user id 0, which is what determines that it’s the superuser.

This is alluded to by the title of this FreeBSD FAQ entry, “What is this UID 0 toor account? Have I been compromised?”

  • 1
    As simple as that. Thanks! So all su accounts are really just aliases of the same account? But with possibly different other settings? – Stilez Nov 8 at 11:12
  • 1
    Yes, the other entries in /etc/passwd and related files can be different, so you can have multiple superuser accounts with different passwords (which is the original point of toor), different shells (common in the past with statically-linked shells), different home directories... – Stephen Kitt Nov 8 at 11:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.