Please take this survey to help us learn more about how you use third party tools. Your input is greatly appreciated!

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?


  • marcothesanemarcothesane Administrator

    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.

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file

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