Quote:
Originally Posted by Ratamahatta
Interesting. I thought that what sudo asks for (no password, user's password, root's password) depends entirely on the sudoers file. At least it's been that way on every desktop Linux system I have used.
And seriously, setting up the sudoers file so that all users can use root privileges is the worst possible idea for a company. We're not talking about a single-user-owned Laptop here.
When last I looked, the suid bit wasn't working with scripts. That's why writing a tiny C program that will hardcodedly execute some command is a better (as in portable, working, etc.) bet. You have to make sure to set the permissions right though, so users will not be able to change the command to be executed.
|
If you gave users the root password there would be no need for sudo in the first place as they'd be able to simply login as root and do anything they want. I'd be surprised if you'd run across a setup that relied on root's password for sudo but anything is possible.
It is barely possible you're confusing "su" (switch user) with "sudo" (super user do). If you do su by default it wants to switch to root and that DOES require the root password. (Similarly if you used su and specified a user it would switch to that user and prompt for that user's password.)
Using sudo by default asks for the invoking user's password. It CAN be configured to not require a password.
You seem to misunderstand the purpose of sudo. It is NOT the same as "su" which is switch user. Giving a user (or even a group of users) a grant to run a single command does NOT automatically give them a grant to run everything as root.
In fact you can setup multiple groups, hosts, commands and grants to do things differently based on which user is invoking the command and on which host they are doing the invocation. That is to say you don't have to give an entire group access to a command - you can give it to one person.
Sudo does NOT rely on the suid bit for the commands being invoked because sudo itself has the suid bit. The commands simply need to be executable by root.
I have seen bad setups where people do something silly like grant "sudo vi" without paying attention to the fact that vi has an escape to the shell. Since the "vi" session invoked by sudo would be running as root then the shell escaped to would be a root shell. However, these days sudo even has settings specifically to prevent such root escapes.
Also although sudo itself runs commands as root one doesn't have to setup programs that run as root. Here one of the uses we have for sudo is to allow certain users to become other administrative users e.g. We might allow all of our DBAs to switch to the "postgres" user to administer the Postgresql database. In such a case they type "sudo su - postgres". They then input their own passwords. They are then at the shell prompt for postgres user. Even though it was root that switched them from their own account to postgres account at no point are the DBAs actually the root user.
sudo has been around for many years and is a very good tool. Once you are used to its sudoers file setup really isn't that hard.