basforge

Search titles, text and the “If it doesn’t work” cases.

    RU

    Keep passwords out of command arguments

    A password in arguments (-p'password', --password=…, curl -u user:pass) stays in ~/.bash_history and is visible in ps to every user on the server while the command runs.

    Where to take the password from

    From the environment inside the container — sh -c '… -p"$MARIADB_ROOT_PASSWORD"' — or from a file: --password-file, --defaults-extra-file. A database dump without the password on the command line:

    docker exec db sh -c 'exec mariadb-dump -u root -p"$MARIADB_ROOT_PASSWORD" --single-transaction app' | gzip > app.sql.gz

    The outer single quotes make the shell inside the container expand $MARIADB_ROOT_PASSWORD, not the one on the host.

    If the password has already landed in history or a chat, change it (Secrets in Docker stacks).