Gentoo Archives: gentoo-dev

From: William Hubbs <williamh@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] sudo vs su
Date: Sun, 28 Feb 2010 20:42:36
Message-Id: 20100228204226.GA28137@linux1
In Reply to: Re: [gentoo-dev] sudo vs su by Denis Dupeyron
1 On Sun, Feb 28, 2010 at 12:52:01PM -0700, Denis Dupeyron wrote:
2 > Some systems are configured with a random root password. After a while
3 > you get tired of doing 'sudo <command>' all the time and would like to
4 > become root but you can't because you don't know the root password.
5 > One way around that is 'sudo su -' which allows to become root using
6 > your user password.
7
8 Actually, by default, sudo command uses your user password (it does
9 here anyway), and su - uses the root password. afaik sudo can be
10 configured to require the root password in the sudoers file, but it
11 doesn't by default. To test it, run this as a user:
12
13 sudo -i
14
15 That should ask for a password. Try your user password there. Once
16 you authenticate, you will be put in a shell with root's environment.
17
18 On the other hand, "su -" requires the root password and does the same
19 thing as "sudo -i".
20
21 In affect, when you run "sudo su -" what you are doing is running sudo
22 and authenticating to it. Then you are running "su -" as the command
23 you want sudo to run as root.
24
25 William