On Thu, Nov 4, 2010 at 12:41 AM, JAGANADH G <[email protected]> wrote:
> Dear All
> "sudo yum search mysqldb"
> "su -c 'yum search mysqldb'"
>
> which one is correct.
Question is wrong.
The first form is correct.
su -c is switch user to someone.
Look at sections in man su.
-c login-class
Specify a login class. You may only override the default class
if you're already root.
EXAMPLES
Run the command ``makewhatis'' as user ``bin''. You will be asked for
bin's password unless your real UID is 0.
$ su bin -c makewhatis
Same as above, but the target command consists of more than a single
word:
$ su bin -c 'makewhatis /usr/local/man'
Same as above, but the target command is run with the resource limits of
the login class ``staff''. Note that the first -c option applies to su
while the second is an argument to the shell.
$ su -c staff bin -c 'makewhatis /usr/local/man'
Whereas in the case of sudo, the /etc/sudoers file determines which
commands normal users can run without being root
with root privileges.
This is to avoid using the very dangerous setuid bit in executables.
-Girish
_______________________________________________
ILUGC Mailing List:
http://www.ae.iitm.ac.in/mailman/listinfo/ilugc