my user "warker" has a script in /home/warker/scr/bak with the following content:
echo Database Backup
pg_dumpall -Uwww > /home/wagner/bak/dbs.sql
When I call this script as user warker, it works fine.
However, there is a system-wide backup script /root/scr/bak with the following contents:
echo "User Backup"
su -c /home/warker/scr/bak warker
When I call this script as root, I get the following error:
could not change directory to "/root": Permission denied
I found that this error is caused by pg_dumpall, which is a script.
What's the problem here?