Photo by Kevin Horvat on Unsplash
Hi, happy to join your community. This is my first post, so I start from the simple one, but useful. Maybe you don’t know about it yet.
or something else, but sometimes it must be safe like
The problem is if anyone accesses the server bash and enters the history command it will see the secrets:
... 1989 export MYSQL_PASSWORD=my_secret_mysql_password ... 2000 history
$ export HISTCONTROL=ignorespace
ignorespace means that if you leave the space before any bash command, it will be ignored in history.
So while exporting the secret environment variable, enter the space before export
$ export HISTCONTROL=ignorespace # keep in mind space before export $ export MYSQL_PASSWORD=my_secret_mysql_password $ history
So now, the Mysql password will be ignored in history
... 1999 export HISTCONTROL=ignorespace 2000 history
Good luck and be safe! 🙂
Previously published at https://dev.to/epranka/hide-the-exported-env-variables-from-the-history-49ni