Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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 stackoverflow.com Feb 10 '12 at 0:42

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

2 Answers 2

.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 - 

or

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

Your Answer

 
discard

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