Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I know what should be the difference between su and su -, but in my system (Debian) for example PATH is the same:

[root]# su
[root]# echo $PATH
[root]# exit
[root]$ su -
[root@debian ~]# echo $PATH

So I'm starting to think that the settings can be changed in configuration files.

share|improve this question
Please see unix.stackexchange.com/questions/7013/… – jsbillings Feb 23 '11 at 18:08
They're the same because the path for your normal user is already the same as that for root. – mattdm Feb 23 '11 at 19:38
What distribution/operating system? The exact answer depends, for example the defaults are different for Red Hat/Fedora and Debian/Ubuntu. – Mikel Feb 23 '11 at 20:59
up vote 5 down vote accepted

For configuring the su PATH, have a look at /etc/login.defs:

ENV_SUPATH      PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
ENV_PATH        PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games

There are also a number of other places PATH can be changed, including:

  • /etc/environment
  • /etc/bash.bashrc
  • /etc/profile
  • /etc/profile.d/*
  • ~/.bashrc
  • ~/.bash_profile

Without anything special in per-user settings, su seems to be getting its PATH from /etc/environment and su - seems to be getting its environment from /etc/login.defs ENV_SUPATH.

So on your system, my guess is that you have the same PATH value in /etc/login.defs as in /etc/environment, or you have some extra configuration in /etc/profile.d, /etc/bash.bashrc, or some rc file in /home/someuser.

share|improve this answer

Parameter - means starting environment which is almost the same as with login environment for that user.

Without - environment is same as original user's environment.

For example PATH is usually same for root and normal users. In some systems there is no sbin folders for normal users. You can't disable - from su easily. Of course you can go to edit the source code.

You can try this by running

export FOO=bar
su # enter your password
echo $FOO
su - # enter your password again
echo $FOO

In first time echo $FOO prints "bar" and in second time it's empty.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.