Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
sudo allows you to run a privelaged program. It does not give you root access to the system. For sudo, you have to be in the /etc/sudoers file & then you can use sudo only for what the administrator gives you permission to execute
su allows you to become root. At that point you can do anything, including run privelaged programs, but you can also do anything else that root could do.
The difference between the two examples you gave is this.
(1) Once you've entered yum install someprogram, you still have root level access to your system. You must type exit to get back to your user level access.
(2) Once you've entered yum install someprogram, you return to your user account access as a normal user.
Last edited by musicman_ace; 12-04-2006 at 06:07 AM.
sudo if configured properly is useful in a multi-user environment - when other users might have to run privileged (root) programs but it's not wise that they have access to the root account. On the other hand, you're likely to use su more often on a home machine with a single user (since you'll be both the administrator and the user and you'll know the root password). In that case, su is probably more convenient.
Sudo is (mostly) mode secure than su, because you can limit the things it can do: You could, for instance, give every user "sudo" access to the shutdown command if you want to make sure that the PC can be turned off when you're not there. But they wouldn't be able to do anything else.
A badly set-up sudo, tho, is an open invitation for people to become root: "sudo bash" gets the user a root shell, for instance. . .
And, in addition to what Hari said: sudo's greatest advantage over su
is that it leaves an audit-trail; you know who did what at which time.
Ideally in a corporate environment with shared powers (if more than one
person needs to have root-access, and you log to a remote box) it's fairly
safe to say that you'll see who did what, and if someone decided to do a
sudo su - you'd still get a fair idea of as to who might have done bad
things without an actual history entry.
Also, su actually means switch user (not super user), so as root, you can then switch to any other user.
are different: the 1st makes you root, but with your original non-root env; the 2nd makes you root with root's env.
Similarly for su-ing to other users.