Tell me more ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I wanted to set environment variables JAVA_HOME and PATH. So I wanted to open ~/.pam_environment since it is the best place to set environment variables relevant to a particular user according to the link https://help.ubuntu.com/community/EnvironmentVariables.

The link states:

Session-wide environment variables

Environment variable settings that should affect just a particular user (rather then the >system as a whole) should be set into:

~/.pam_environment - This file is specifically meant for setting a user's
environment. It is not a script file, but rather consists of assignment expressions, one per line.

The problem I have is that I am not able to open the file ~/.pam_environment by using the command gedit ~/.pam_environment.

I do not know whether this is the right way to open this file, please point me in the right direction.

share|improve this question
I am having this problem too. Even for me the file .pam_environment doesn't exist. I too referred to the same link. One good point to note is that you can press Ctrl + H to show the hidden files. This is a general recommendation - it won't solve your current problem as the file is simply not there. – Shashank Sawant May 26 '12 at 7:26
1  
If it does not exist you create it... – Rinzwind May 26 '12 at 8:05

2 Answers

Note that .pam_environment does not use the normal syntax. You should strictly follow the pam_env.conf syntax.

In particular if you want to set the JAVA_HOME and PATH variables you can put this content into your .pam_environment:

JAVA_HOME DEFAULT=<the-path-to-java-home
PATH DEFAULT=${PATH}:extend/the:path

Following Rinzwind answer will most likely brick your login[1]. In which case you can re login into a TTY using Ctrl + Alt + F1 and remove the .pam_environment file with the command:

/bin/rm ~/.pam_environment

[1] At least on my computer with Kubuntu 12.04

share|improve this answer

If that file does not exist you create it.

Mind you: if not formatted correctly lines from that file are ignored. The lines need to be formatted like this:

PYTHONPATH=$PYTHONPATH:$HOME/bin/wikidpad/lib/
PATH=/var/lib/gems/1.8/bin:$PATH

where every var is on a separate line (as per the text in the question).

And for the lines to be used you probably need to (at least) login again.

share|improve this answer

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.