How to alter role from command line in postgresql?
What's wrong is the lack of -c
or --command
for su
to indicate that the rest of the line is a command.
But su
is not needed anyway, because there's already sudo
. Do this instead:
sudo -u postgres psql -c "ALTER ROLE postgres WITH password 'pass'"