LinuxQuestions.org
Register a domain and help support LQ
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, 04:16 PM   #1
Thaidog
Member
 
Registered: Sep 2002
Location: Hilton Head, SC
Distribution: Gentoo
Posts: 636

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, 04:19 PM   #2
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Ubuntu
Posts: 8,507

Rep: Reputation: 122Reputation: 122
'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, 04:21 PM   #3
Thaidog
Member
 
Registered: Sep 2002
Location: Hilton Head, SC
Distribution: Gentoo
Posts: 636

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, 04:25 PM   #4
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Ubuntu
Posts: 8,507

Rep: Reputation: 122Reputation: 122
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, 04: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, 04:45 PM   #6
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Ubuntu
Posts: 8,507

Rep: Reputation: 122Reputation: 122
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, 04: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, 04:58 PM   #8
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Ubuntu
Posts: 8,507

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


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 01:05 AM
difference between a tv tuner & TV-Out eastsuse General 2 02-08-2005 10:36 PM
what is the difference between Fork & exec augustus123 Linux - Newbie 1 11-29-2004 08:32 AM
App & Utility difference? sikandar Linux - Software 3 09-22-2003 02:33 AM
Difference between KDE & Gnome ? joeca12 Linux - General 6 12-14-2002 02:58 PM


All times are GMT -5. The time now is 02:57 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration