LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 03-16-2012, 09:14 AM   #1
rng
Senior Member
 
Registered: Aug 2011
Posts: 1,198

Rep: Reputation: 47
Any difference between 'su' and 'su -' ?


What is the difference between 'su' and 'su -' commands to login as root?
 
Old 03-16-2012, 09:29 AM   #2
snowday
Senior Member
 
Registered: Feb 2009
Posts: 4,667

Rep: Reputation: 1411Reputation: 1411Reputation: 1411Reputation: 1411Reputation: 1411Reputation: 1411Reputation: 1411Reputation: 1411Reputation: 1411Reputation: 1411
"man su" will give you the full details, but basically, "su" keeps you in the user's shell environment, but with root's privileges, while "su -" is a full root login with root's path and environment variables.

Here is a quick demo of what I mean:

Code:
su
$PATH
exit
su -
$PATH
exit
You should see that "su" uses your user's /bin, for example, and "su -" uses /root/bin.

I almost always use "su -" personally.

If you are using Ubuntu then see here instead: https://help.ubuntu.com/community/RootSudo

Last edited by snowday; 03-16-2012 at 09:34 AM.
 
1 members found this post helpful.
Old 03-16-2012, 09:34 AM   #3
rng
Senior Member
 
Registered: Aug 2011
Posts: 1,198

Original Poster
Rep: Reputation: 47
I am using slackware.
 
Old 03-16-2012, 09:43 AM   #4
snowday
Senior Member
 
Registered: Feb 2009
Posts: 4,667

Rep: Reputation: 1411Reputation: 1411Reputation: 1411Reputation: 1411Reputation: 1411Reputation: 1411Reputation: 1411Reputation: 1411Reputation: 1411Reputation: 1411
Quote:
Originally Posted by rng View Post
I am using slackware.
Chapter 8 of Slackbook will give you a general intro to bash shell and environment variables.

http://www.slackbook.org/html/index.html
 
Old 03-16-2012, 11:19 AM   #5
rng
Senior Member
 
Registered: Aug 2011
Posts: 1,198

Original Poster
Rep: Reputation: 47
Thanks.
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Making a Difference; Selling a Difference LXer Syndicated Linux News 0 09-23-2010 05:00 AM
shell script to find the difference betwwn two file and place the difference to other kittunot4u Linux - General 3 07-19-2010 04:26 AM
difference between... GEJOE DANIEL General 3 11-21-2005 05:49 AM
Difference Between..... SmithSmith123 Linux - Certification 1 11-17-2005 02:51 AM
What is the difference? pearsonx4 Linux - Newbie 4 10-05-2003 10:34 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 04:24 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
Open Source Consulting | Domain Registration