How can I hide passwords for vsql in shell scripts?
Moderator: NorbertKrupa
How can I hide passwords for vsql in shell scripts?
I usually place the username and password on the vsql command line in scripts. However, the "ps" command will show the command line of the process to other users, thus revealing the username and password for the account! Is it possible to hide the password from other users when they invoke "ps"?
Bud Anderson
- JimKnicely
- Site Admin
- Posts: 1825
- Joined: Sat Jan 21, 2012 4:58 am
- Contact:
Re: How can I hide passwords for vsql in shell scripts?
Check out the VSQL_PASSWORD environment variable. You can set it to the password to use for the connection.
On page 279:
https://my.vertica.com/docs/6.1.x/PDF/H ... sGuide.pdf
On page 279:
https://my.vertica.com/docs/6.1.x/PDF/H ... sGuide.pdf
Jim Knicely
Note: I work for Vertica. My views, opinions, and thoughts expressed here do not represent those of my employer.
Note: I work for Vertica. My views, opinions, and thoughts expressed here do not represent those of my employer.
Re: How can I hide passwords for vsql in shell scripts?
Hey, thanks, Jim. VSQL_PASSWORD works!
Code: Select all
[dbadmin@v01 ~]$ cat ladies.sh
export VSQL_PASSWORD=man
vsql -U ladies -c "select count(*) from dual;"
[dbadmin@v01 ~]$ ./ladies.sh
count
-------
1
(1 row)
Bud Anderson
Re: How can I hide passwords for vsql in shell scripts?
-w vs using VSQL_PASSWORD: I'm looking at my process list after using "-w", and the password isn't there. Does Vertica somehow prevent the system from seeing the password?
-
- GURU
- Posts: 527
- Joined: Tue Oct 22, 2013 9:36 pm
- Location: Chicago, IL
- Contact:
Re: How can I hide passwords for vsql in shell scripts?
Showing the password seems not secure to me.
Checkout vertica.tips for more Vertica resources.
- JimKnicely
- Site Admin
- Posts: 1825
- Joined: Sat Jan 21, 2012 4:58 am
- Contact:
Re: How can I hide passwords for vsql in shell scripts?
Hi dbmsuser7,
I think that the password showing in a ps command was an issue in older versions of vsql. It does not seem to be an issue now (i.e. Version 7).
I think that the password showing in a ps command was an issue in older versions of vsql. It does not seem to be an issue now (i.e. Version 7).
Code: Select all
[dbadmin@vertica01 ~]$ cat cow.sh
vsql -U cow -w patty -c "select sleep(30);"
[dbadmin@vertica01 ~]$ ./cow.sh &
[1] 14458
[dbadmin@vertica01 ~]$ ps -ef | grep -i vsql
dbadmin 14459 14458 0 11:38 pts/0 00:00:00 vsql -U cow -w -c select sleep(30);
dbadmin 14475 9246 0 11:38 pts/0 00:00:00 grep -i vsql
[dbadmin@vertica01 ~]$ sleep
-------
0
(1 row)
[1]+ Done ./cow.sh
[dbadmin@vertica01 ~]$
Jim Knicely
Note: I work for Vertica. My views, opinions, and thoughts expressed here do not represent those of my employer.
Note: I work for Vertica. My views, opinions, and thoughts expressed here do not represent those of my employer.
Re: How can I hide passwords for vsql in shell scripts?
Hi!
[DELETED]
[DELETED]
Last edited by id10t on Fri May 08, 2015 9:12 pm, edited 1 time in total.