Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have this in /etc/profile in Fedora 17:

PATH=$PATH:"/usr/pgsql-9.2/bin"
EDITOR="/usr/bin/emacs -nw"
PSQL_EDITOR="/usr/bin/emacs"
PAGER="/usr/bin/less"

export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL EDITOR PSQL_EDITOR PAGER

The $PATH variable concatenation is in effect when I login as root or as postgres but not when I login to my account. I'm using terminator.

As root:

# echo $PATH
/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/pgsql-9.2/bin:/root/bin

As postgres:

$ echo $PATH
/usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/usr/pgsql-9.2/bin:/usr/pgsql-9.2/bin

In my account:

$ echo $PATH
/usr/lib64/qt-3.3/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/home/cpn/.local/bin:/home/cpn/bin

Notice the absence of the /usr/pgsql-9.2/bin path.

/home/cpn/.bash_profile has this line:

PATH=$PATH:$HOME/.local/bin:$HOME/bin
export PATH

When I su - (notice the -) to my account the path is there so I guess it is a matter of login vs not login shell.

How to make the terminal to always open a login shell?

share|improve this question
    
Most, but not all, login methods read /etc/profile. How do you log in? If you use a graphical display manager (a program where you type your password in graphics mode), which one (e.g. gdm, kdm, lightdm, …)? –  Gilles Oct 8 '12 at 23:46
    
@Gilles I'm using Terminator. Edited the question to add it. –  Clodoaldo Oct 9 '12 at 0:03
    
Terminator is a terminal emulator in which you can run a shell. How do you log in (i.e. where do you type your username and password)? –  Gilles Oct 9 '12 at 0:06
    
@Gilles I login to Cinnamon. I guess it uses gdm. –  Clodoaldo Oct 9 '12 at 0:52
    
@Clodoaldo If you need to have the path set, why not try to simply include . /etc/profile as the first line of your .bash_profile? –  Karlson Oct 9 '12 at 13:33
add comment

2 Answers 2

If you want the directory in your PATH for all sessions, you could add it to /etc/environment. Be careful if you do that though - if you screw up the PATH in /etc/environment there's a chance that your system will not boot anymore.

share|improve this answer
add comment

Don't know if this is the correct fix. I did check Run command as a login shell in terminator -> profiles -> Command.

share|improve this answer
    
No, that's not a good idea. See Alternative to .bashrc –  Gilles Oct 8 '12 at 23:45
1  
As Gilles noted, there's a difference between login and non-login shells, so that non-login ones do not load /etc/profile by default, as described here: linuxfromscratch.org/blfs/view/svn/postlfs/profile.html. So it seems to depend on gdm (if it's still gdm), whether it sources "/etc/profile" or not. Try reading /etc/gdm/Xsession, it might not contains the source strings, as in bugs.launchpad.net/ubuntu/+source/lightdm/+bug/794315 –  Bob Oct 9 '12 at 10:21
add comment

Your Answer

 
discard

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.