How can I hide passwords for vsql in shell scripts?

Moderator: NorbertKrupa

User avatar
bud
Newbie
Newbie
Posts: 14
Joined: Fri Oct 11, 2013 1:45 am

How can I hide passwords for vsql in shell scripts?

Post by bud » Fri Nov 15, 2013 4:18 pm

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

User avatar
JimKnicely
Site Admin
Site Admin
Posts: 1825
Joined: Sat Jan 21, 2012 4:58 am
Contact:

Re: How can I hide passwords for vsql in shell scripts?

Post by JimKnicely » Fri Nov 15, 2013 5:54 pm

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
Jim Knicely

Image

Note: I work for Vertica. My views, opinions, and thoughts expressed here do not represent those of my employer.

User avatar
bud
Newbie
Newbie
Posts: 14
Joined: Fri Oct 11, 2013 1:45 am

Re: How can I hide passwords for vsql in shell scripts?

Post by bud » Fri Nov 15, 2013 8:49 pm

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

dbmsuser7
Intermediate
Intermediate
Posts: 71
Joined: Tue Jan 28, 2014 3:03 am

Re: How can I hide passwords for vsql in shell scripts?

Post by dbmsuser7 » Fri Feb 07, 2014 4:08 pm

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

NorbertKrupa
GURU
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?

Post by NorbertKrupa » Fri Feb 07, 2014 5:23 pm

Showing the password seems not secure to me.
Checkout vertica.tips for more Vertica resources.

User avatar
JimKnicely
Site Admin
Site Admin
Posts: 1825
Joined: Sat Jan 21, 2012 4:58 am
Contact:

Re: How can I hide passwords for vsql in shell scripts?

Post by JimKnicely » Fri Feb 07, 2014 5:44 pm

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

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

Image

Note: I work for Vertica. My views, opinions, and thoughts expressed here do not represent those of my employer.

id10t
GURU
GURU
Posts: 732
Joined: Mon Apr 16, 2012 2:44 pm

Re: How can I hide passwords for vsql in shell scripts?

Post by id10t » Sun Feb 09, 2014 11:42 am

Hi!

[DELETED]
Last edited by id10t on Fri May 08, 2015 9:12 pm, edited 1 time in total.

Post Reply

Return to “New to Vertica”