WebSVN "Error running this command", "Permission denied" fixed

Example error:

Error running this command:

svn --non-interactive --config-dir /tmp list --xml 'file:///mnt/example/www.example.com/web/repository/@'

Unable to open an ra_local session to URL
Unable to open repository 'file:///mnt/example/www.example.com/web/repository'
Can't open file '/mnt/example/www.example.com/web/repository/format': Permission denied

How to fix:

Edit quoteCommand() in ../include/command.php quoteCommand() should read:

function quoteCommand($cmd) {
    global $config;

    // On Windows machines, the whole line needs quotes round it so that it's
    // passed to cmd.exe correctly

    if ($config->serverIsWindows) {
        $cmd = '"'.$cmd.'"';
    } else {
        $cmd = 'sudo -u root ' . $cmd;
    }

    return $cmd;
}

Add: else { $cmd = 'sudo -u root ' . $cmd; } to give svn permission.

2 comments

  1. anonymous

    chown www-data /path/to/directory

    would work too i believe

  2. anonymous

    also add to /etc/sudoers file:

    www-data ALL=(ALL) NOPASSWD:ALL

    sudo bash -c 'echo -e "www-data ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers'

Leave a Reply