Super User is a question and answer site for computer enthusiasts and power users. 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 am running ubuntu on a flash drive. The default log in is "ubuntu". I installed Postgresql and created a new user called "postgres". However, when I switch to postgres with "su postgres", the environmental path variable that I modified to be able to run psql from the terminal is gone. I'm guessing that postgres has it's own files to edit to change the PATH, but I don't know where it its? The .profile file that I can see from the GUI already has the PATH variable modified.

Thanks in advance.

share|improve this question

migrated from Feb 10 '12 at 0:42

This question came from our site for professional and enthusiast programmers.

.profile is only read during login. It should read it if you start a login shell with su - postgres or su -l postgres. In case you use bash, just set the PATH variable in .bashrc, this file gets read during a normal su. Also, you could preserve the current environment for the new user by runnin su -m postgres

share|improve this answer

If the postgres user has the PATH setup correctly in the relevant shell rc file, you may want to use:

su - 


su -l

to simulate full login.

share|improve this answer
sorry, my apologies, I have suing su - postgres. – tim tran Feb 9 '12 at 23:19

You must log in to answer this question.