Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

This question already has an answer here:

I'm trying to move things from my .bashrc to .pam_enviroment because of this. I've put the following into my .pam_environment but this prevents me from logging in because there should be some mistake. I've then removed .pam_environment while in recovery mode.

VISUAL       DEFAULT=/usr/local/bin/vim
EDITOR       DEFAULT=/usr/local/bin/vim
PATH         DEFAULT=/usr/local/src/rbenv/bin:$PATH
WORKON_HOME  DEFAULT=$HOME/.virtualenv
GOROOT       DEFAULT=/usr/local/src/go
PATH         DEFAULT=$PATH:$GOROOT/bin
GOPATH       DEFAULT=$HOME/.go
PATH         DEFAULT=$PATH:$GOPATH/bin
PATH         DEFAULT=$PATH:/usr/local/src/llvm/tools/clang/tools/scan-build
PATH         DEFAULT=$PATH:/usr/local/src/llvm/tools/clang/tools/scan-view
PATH         DEFAULT=$PATH:/usr/local/src/.build/kint/bin
M2_HOME      DEFAULT=/opt/apache-maven/apache-maven-3.0.5
M2           DEFAULT=$M2_HOME/bin
PATH         DEFAULT=$M2:$PATH
JAVA_HOME    DEFAULT=/usr/lib/jvm/default-java
PATH         DEFAULT=$JAVA_HOME/bin:$PATH
ECLIPSE_HOME DEFAULT=/opt/eclipse
PATH         DEFAULT=$ECLIPSE_HOME:$PATH

What's the problem with these settings? As I said in my previous question, I'm still trying to figure out a good way to have global settings for all my applications, as it worked before when .profile/.bashrc was enough for this...

share|improve this question

marked as duplicate by Eliah Kagan, Luis Alvarado Aug 8 '13 at 10:25

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer 1

up vote 1 down vote accepted

I've learned from the web of someone that got in the same trouble. .pam_environment syntax for referring to variables must include curly braces, fixing this has solved the problem:

VISUAL       DEFAULT=/usr/local/bin/vim
EDITOR       DEFAULT=/usr/local/bin/vim
PATH         DEFAULT=/usr/local/src/rbenv/bin:${PATH}
WORKON_HOME  DEFAULT=${HOME}/.virtualenv
GOROOT       DEFAULT=/usr/local/src/go
PATH         DEFAULT=${PATH}:${GOROOT}/bin
GOPATH       DEFAULT=${HOME}/.go
PATH         DEFAULT=${PATH}:${GOPATH}/bin
PATH         DEFAULT=${PATH}:/usr/local/src/llvm/tools/clang/tools/scan-build
PATH         DEFAULT=${PATH}:/usr/local/src/llvm/tools/clang/tools/scan-view
PATH         DEFAULT=${PATH}:/usr/local/src/.build/kint/bin
M2_HOME      DEFAULT=/opt/apache-maven/apache-maven-3.0.5
M2           DEFAULT=${M2_HOME}/bin
PATH         DEFAULT=${M2}:${PATH}
JAVA_HOME    DEFAULT=/usr/lib/jvm/default-java
PATH         DEFAULT=${JAVA_HOME}/bin:${PATH}
ECLIPSE_HOME DEFAULT=/opt/eclipse
PATH         DEFAULT=${ECLIPSE_HOME}:${PATH}

I don't find it a best approach, but what I'm doing now is setting variables at .pam_environment for them to take effect for any application (not just the ones started from bash) and putting setup that requires additional logic beyond trivial assignment into .profile/.bashrc.

share|improve this answer

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