The Vertica Forum recently got a makeover! Let us know what you think by filling out this short, anonymous survey.

How do I handle the password in vsql command in crontab?

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?


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

  • SergeBSergeB Employee

    If suitable in your environment,, another solution is to have a passwordless authentication method (TRUST, TLS with self-authentication or Kerberos)

  • ChuckBChuckB Employee

    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.

Sign In or Register to comment.

Can't find what you're looking for? Search the Vertica Documentation, Knowledge Base, or Blog for more information.