newbie question: whats the difference between "su root", "su" and "su -&quo
SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
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.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
"su" is equiv "su root" and "su -" equiv "su - root"
the diff between "su" and "su -" is "su -" you log in as a root with the env setting/profile (i.e you really log in as a root). just type "pwd" and you will be in the root home dir @ /root.
if you "su" only then basically you just "borrow" the root permission without having all the root env setting/profile . just "su" from your home dir and type "pwd", you can see that you still in the user dir i.e /home/user
Anyway, I thinks the main differences are path (su - root have env path of /sbin and/usr/sbin) that make ones have the rights to run commands
wow. I think the discussion of this topic is fruitful, I am compile it over to my website and added few example. I hope this is ok and does not violate forum's rules
You might find the website a bit lack of info at this moment, sorry guys I compiling and start writing on the site
Last edited by linuxhantu; 12-07-2009 at 03:55 AM.
Reason: Dead Threat....wrong forum posting
They're just different paths to get to the same destination.
Su is short for super user.
You'll use it when you're logged in as a user and wish to do something that requires root privileges.
Using su or sudo [to name a couple commonly used]is the only way to access root privileges while logged in as a user unless one wishes to reboot and log in as root.
To time consuming and a pita to do.
If you happen to be using a kde desktop, at times you may also be required to use kdesu to gain root privileges as needed while logged in as user.
kdesu is the kde equivalent of su.
sudo is nothing more than another path to becoming a super user.
sudo has to be set up if using Slack,, at least in 12.2.
I myself have seldom if ever had the need for it.
I've only used kdesu once in Slack and then it was to set up hplip.
If you're not logged in at all, but are at the log in stage and wish to accomplish something that requires root privileges, then you have the option to log in as root.
A good reason to log in as root would be to set up a user account so you don't have to log in as root.
It's just to make things easier for a person to run as user instead of root yet provide an easy way to access root when needed.
I've heard that before, which is surprising considering what the man page says on the subject:
Quote:
su - run a shell with substitute user and group IDs
and thinking of it as the 'super user' command is a bit odd when you consider that you can switch to users other than root.
Quote:
Using su or sudo [to name a couple commonly used]is the only way to access root privileges while logged in as a user unless one wishes to reboot and log in as root.
Or, log out and log in, rather than rebooting.
Quote:
sudo is nothing more than another path to becoming a super user.
from the man page:
Quote:
sudo allows a permitted user to execute a command as the superuser or another user
So, primarily, sudo is for when you want to run a single command, and su is when you want to run a succession of them.
The argument for having su/sudo is that if you don't have this kind of facility, you'll log in as root for most things, because you might have to do something as root, and doing everything as root is bad.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.