Обсуждение: Postgres User Home ENV Help

Поиск
Список
Период
Сортировка

Postgres User Home ENV Help

От
"carlosinfl ."
Дата:
Can someone please help me set the 'postgres' users home ENV so that I
can simply type 'psql' rather than the rull path and bash doesn't say
'-bash-4.1$'?

-bash-4.1$ whoami;ls -l;pwd
postgres

total 12
drwx------  2 postgres postgres 4096 Apr  4 18:33 backups
drwx------ 15 postgres postgres 4096 Jun 18 20:52 data
-rw-------  1 postgres postgres 1493 Jun 14 21:11 pgstartup.log

/var/lib/pgsql9

--
Carlos Mennens


Re: Postgres User Home ENV Help

От
michael mccafferty
Дата:
I think you are trying to solve the wrong problem. 

You should not be switching to user 'postgres' regularly enough that the default bash shell bothers you. Instead, you should switch to user 'postgres' only when you need superuser access to create new roles, permissions, databases, etc. 

If you create a role that match your normal login, then you can run 'psql' from your normal account, and you won't need to customize user postgres' shell environment.

My two cents,
and my best regards,

Mike M


On Thu, Jun 20, 2013 at 2:13 PM, carlosinfl . <carlos.mennens@gmail.com> wrote:
Can someone please help me set the 'postgres' users home ENV so that I
can simply type 'psql' rather than the rull path and bash doesn't say
'-bash-4.1$'?

-bash-4.1$ whoami;ls -l;pwd
postgres

total 12
drwx------  2 postgres postgres 4096 Apr  4 18:33 backups
drwx------ 15 postgres postgres 4096 Jun 18 20:52 data
-rw-------  1 postgres postgres 1493 Jun 14 21:11 pgstartup.log

/var/lib/pgsql9

--
Carlos Mennens


--
Sent via pgsql-novice mailing list (pgsql-novice@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-novice

Re: Postgres User Home ENV Help

От
Luca Ferrari
Дата:
On Thu, Jun 20, 2013 at 11:13 PM, carlosinfl . <carlos.mennens@gmail.com> wrote:
> Can someone please help me set the 'postgres' users home ENV so that I
> can simply type 'psql' rather than the rull path and bash doesn't say
> '-bash-4.1$'?
>
> -bash-4.1$ whoami;ls -l;pwd
> postgres
>
> total 12
> drwx------  2 postgres postgres 4096 Apr  4 18:33 backups
> drwx------ 15 postgres postgres 4096 Jun 18 20:52 data
> -rw-------  1 postgres postgres 1493 Jun 14 21:11 pgstartup.log
>
> /var/lib/pgsql9
>


First you have to find out where 'psql' executable is, and from the
path I guess it is a linux distro with a packaged postgresql version.
Usually psql lies in /usr/local/bin or /usr/bin, so setting the PATH
variable to include such directory should work.
First of all check what the PATH varaible is:
echo $PATH
and then find out where psql is and add the directory to PATH:
PATH=$PATH:<new-dir>
and make it permanent.
However, as already suggested, you should not use the "postgres" user,
but you can do the above steps also for a normal account.

Hope this helps.
Luca


Re: Postgres User Home ENV Help

От
amulsul
Дата:
>Can someone please help me set the 'postgres' users home ENV so that I
>can simply type 'psql' rather than the rull path and bash doesn't say
>'-bash-4.1$'?

You, need to log in your system, do the following steps

1. open file  .bash_profile as  " vim  ~/.bash_profile "

2. Add line  " PATH=<path of your postgres bin>:$PATH " without quotation
before "export PATH "
   in my case "PATH=/opt/PostgreSQL/bin:$PATH"

3. save file and run command in terminal " source  ~/.bash_profile "

4. verify it exported correctly or not as follow
 [amul@localhost ~]$ which psql
/opt/PostgreSQL/bin/psql


Regards,
Amul



--
View this message in context:
http://postgresql.1045698.n5.nabble.com/Postgres-User-Home-ENV-Help-tp5760206p5764052.html
Sent from the PostgreSQL - novice mailing list archive at Nabble.com.