How do I handle the password in vsql command in crontab?
Prairiedog
Vertica Customer ✭
I want to schedule a shell script that kicks off a vSQL command from a crontab. I cannot leave an open password in the file and I cannot answer a password prompt when the job kicks off a midnight on a weekend. So how does one use the username to map to the acceptable password to get through the server firewall?
0
Answers
If you have the vsql password in the environment variable VSQL_PASSWORD, it works.
Of course, there's a risk in putting:
export VSQL_PASSWORD='<dbadmin_s_password>'
into the OS user's.bash_profile
or similar.But there's a collection of tools out there that store an encrypted password somewhere and decrypt it on the fly to put it into a shell variable. Worth exploring ...
If suitable in your environment,, another solution is to have a passwordless authentication method (TRUST, TLS with self-authentication or Kerberos)
In addition to what others said, you can use the -w option on the vsql command line to set the password, but from a security perspective that's probably the worst because command lines are frequently visible / logged in places anyone on the machine can see. Investigating other security options makes sense here, as Serge mentioned.