mgdt wrote:
mystran: Haha, how does sudo work? it sounds like sudo is a proccess that has and can give admin access (for a temp time). And has a list or group of admin accounts that it checks when you enter your user/pw.
Well sudo is setuid root, so it can spawn processes as anyone it feels like. It has a configuration file /etc/sudoers (normally, at least) which has a set of rules about who can do what.
Basicly, you say "this user (or group) can run as this other user (on a given host) this program". So you could say that "mgdt" is allowed to run as "root" on a computer called "foobar" a program called "/usr/sbin/foobar" and then when you say (as mgdt on foobar) "sudo /usr/sbin/foobar" it'll let you do that. Normally it ask you your password (your own, just to check that if you left your console open it's really you) if you didn't just run something as sudo. If you try to do something else, and there's no matching entry, it'll deny your request.
Typically on your own machine, you use a ruleset something like:
Code: Select all
root ALL=(ALL) ALL
mgdt ALL=(ALL) ALL
That says that root and mgdt are allowed to do whatever they feel like, as whoever they feel like. You could also use a group like "admin" or "wheel" or something to control who's allowed that much power.
It's pretty flexible. You can make it works just like traditional 'su' requiring the password of the target-user, or you can make it require no-passwords whatsoever. You can make it send mail every time it's used, you can control whether the "authenticated recently" applies globally or only on per-TTY basis, you can control whether environment is cleared (to prevent LD_PRELOAD attacks and similar, when user is allowed some small set of commands) and well... you get the point.
Where did ubuntu come from? I never mentioned that.
Well somebody mentioned, probably because Ubuntu doesn't give you root-password at all when you install it (there's just ! in /etc/shadow preventing authentication as root). It just gives the initial user membership in admin-group, and has a default /etc/sudoers that says anyone in admin group can do whatever they feel like:
Code: Select all
root ALL=(ALL) ALL
%admin ALL=(ALL) ALL
That's straight from my Ubuntu box sudoers, just stripping comments.