I am trying to perform this command but needs a password. This is running on aws instance and I putty to this server using a key.

sudo -u redash pg_dump redash | gzip > /tmp/SHED_redash_backup.gz
[sudo] password for postgres:
Sorry, try again.

Please help. Thanks

Is it possible you’re running this command as the postgres user? Because otherwise I’m not sure why would it ask for its password.

Strange but the command works now after doing a sudo su first. Must have been user error. Thanks!.