• problem with pg_dumpall

    From Magnus Warker@21:1/5 to All on Thu Mar 31 03:43:39 2016
    Hi,

    my user "warker" has a script in /home/warker/scr/bak with the following content:

    #!/bin/sh
    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:

    #!/bin/sh
    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?

    Thanks
    Magnus

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Robert Klemme@21:1/5 to Magnus Warker on Thu Mar 31 11:15:49 2016
    On 31.03.2016 03:43, Magnus Warker wrote:
    Hi,

    my user "warker" has a script in /home/warker/scr/bak with the following content:

    #!/bin/sh
    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:

    #!/bin/sh
    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?

    Your environment most likely carries around the original value of HOME.
    I'd try sudo for a change.

    Kind regards

    robert

    --
    remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Magnus Warker@21:1/5 to All on Fri Apr 1 18:53:36 2016
    Ok, thanks! :-)

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)