LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   newbie question: whats the difference between "su root", "su" and "su -&quo (https://www.linuxquestions.org/questions/slackware-14/newbie-question-whats-the-difference-between-su-root-su-and-su-and-quo-303999/)

mojarron 03-20-2005 03:15 PM

newbie question: whats the difference between "su root", "su" and "su -&quo
 
with all of them i get a password prompt for root, is there any difference between them?

ahh 03-20-2005 03:26 PM

su root is the default command for su.

That is, if you type su it will assume you mean su root. To su to another user you will have to add the users name, e.g. su username.

If you use su you will still have the same envioroment, for example the $PATH variable, as the user who su'd.

If you use su - you will have the envioroment of the user you su'd to.

mojarron 03-20-2005 03:59 PM

o, i see

thanks a lot ahh

xgreen 03-20-2005 10:48 PM

"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

marsguy 03-23-2005 07:14 AM

thank you so much nazmin

you've been of great help!

linuxhantu 12-05-2009 07:50 PM

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

windtalker10 12-06-2009 12:46 PM

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.

salasi 12-06-2009 04:57 PM

Quote:

Originally Posted by windtalker10 (Post 3781904)
Su is short for super user.

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.

Alien Bob 12-06-2009 05:01 PM

Please! Do not try to resurrect long-dead threads. This one was dead for 4.5 years.

@linuxhantu: do not try to advocate your CentOS fansite on a Slackware forum. As if we care.

Eric

windtalker10 12-07-2009 04:08 PM

Quote:

Originally Posted by Alien Bob (Post 3782079)
Please! Do not try to resurrect long-dead threads. This one was dead for 4.5 years.

@linuxhantu: do not try to advocate your CentOS fansite on a Slackware forum. As if we care.

Eric

Geez! I didn't even notice the date of the op!
I will from now on though.


All times are GMT -5. The time now is 03:27 PM.