LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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!

Notices


Reply
  Search this Thread
Old 07-28-2005, 03:16 PM   #1
Thaidog
Member
 
Registered: Sep 2002
Location: Hilton Head, SC
Distribution: Gentoo
Posts: 637

Rep: Reputation: 32
Question What's the difference between su - & su ?


What is the difference with the su - option to root rather than the plain old su option?
 
Old 07-28-2005, 03:19 PM   #2
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
'su -' reads in the root environment (/root/.bash_profile, etc.) as if you'd logged in as root. This is commonly needed to have /usr/sbin and /sbin included in your PATH. 'su' does not do this, and only elevates your privileges.
 
Old 07-28-2005, 03:21 PM   #3
Thaidog
Member
 
Registered: Sep 2002
Location: Hilton Head, SC
Distribution: Gentoo
Posts: 637

Original Poster
Rep: Reputation: 32
Quote:
Originally posted by Matir
'su -' reads in the root environment (/root/.bash_profile, etc.) as if you'd logged in as root. This is commonly needed to have /usr/sbin and /sbin included in your PATH. 'su' does not do this, and only elevates your privileges.
thx... exaclty what I needed!
 
Old 07-28-2005, 03:25 PM   #4
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
No problem. While it IS a matter, of preference, I always use su -. In fact, when I really need to be root, I have an alias that does 'sudo su -'.
Code:
alias rootme='sudo su -'
That was, btw, an idea stolen from the Knoppix LiveCD. (The name rootme).
 
Old 07-28-2005, 03:41 PM   #5
jrdioko
Member
 
Registered: Oct 2002
Distribution: Debian 6.0.2 (squeeze)
Posts: 944

Rep: Reputation: 30
Why "sudo su -" instead of "su -"? Just curious...

I used to use "su -" instead of "su", but when I'm su'ing in the first place it's usually because I need to do something with root permissions in the current directory, and it scares me that "su -" takes you away from that directory to /root. It seems to easy to wipe out root's home with a stray rm command, or worse something else if that rm command had a ".." in it.
 
Old 07-28-2005, 03:45 PM   #6
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
Well, 'su -' gives you (as I said) the environment of root... it makes it a login shell. I use sudo so I don't have to type my (very long) root password all the time. It caches and uses my own password (or you could have it not require any password). It really seems to me to just be a matter of personal preference.
 
Old 07-28-2005, 03:49 PM   #7
jrdioko
Member
 
Registered: Oct 2002
Distribution: Debian 6.0.2 (squeeze)
Posts: 944

Rep: Reputation: 30
I see. Just don't forget that very long root password
 
Old 07-28-2005, 03:58 PM   #8
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
Haven't forgotten it yet... knock on wood. Now, the passwords to all my email accounts.... that's a different matter.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
what is the difference between socket & port? fssengg Linux - Newbie 4 05-16-2005 12:05 AM
difference between a tv tuner & TV-Out eastsuse General 2 02-08-2005 09:36 PM
what is the difference between Fork & exec augustus123 Linux - Newbie 1 11-29-2004 07:32 AM
App & Utility difference? sikandar Linux - Software 3 09-22-2003 01:33 AM
Difference between KDE & Gnome ? joeca12 Linux - General 6 12-14-2002 01:58 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:06 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration