sudo vs root

Alan McKinnon alan at linuxholdings.co.za
Tue May 23 07:53:27 UTC 2006


On Tuesday 23 May 2006 05:38, maxim wexler wrote:
> Hi group,
>
> I note it's possible to install a package by making
> myself root, using the root password and installing or
> by sudo, using my user password and installing.
>
> Which makes me wonder why sudo would ask for my user
> password when I was already logged in as user.
>
> Is there a difference between the two methods in the
> way the package gets installed?

The various installers only have to be run as effective user root, 
they don't care how you got there. If you are already logged in as 
root (I imagine you did a 'sudo passwd' or similar to achieve that?) 
the condition is satisfied so the installer runs.

If you are logged in as a user, this is not enough to run the 
installer, so it will fail. The installer cannot by itself elevate 
your permissions to those of root, so the use of sudo is required. 
Because sudo gives you root permissions, it will explicitly ask you 
for your password to make sure that it really is you typing the 
command. It's a safety check - you might have stepped away from the 
terminal for a minute and someone else is entering commands, this 
could have horrible side effects and would be no different from 
running as root all the time. 

OTOH the default is that sudo remembers that you gave a valid password 
for about 5 minutes or so and doesn't ask for the password again 
within those 5 minutes. If this is a problem for you, the behaviour 
can be disabled.

-- 
If only me, you and dead people understand hex, 
how many people understand hex?

Alan McKinnon
alan at linuxholdings dot co dot za
+27 82, double three seven, one nine three five




More information about the ubuntu-users mailing list