BackupPC FAQ: CGI script problems

The CGI script doesn't run; how do I fix it?

Perhaps the most common problem with the installation is getting the CGI script to run. Often the setuid isn't configured correctly, or doesn't work on your system.

First, try running BackupPC_Admin manually as the BackupPC user, eg:


Now try running it as the httpd user (which ever user apache runs as, which might be httpd or www on your system):

    su httpd

In both cases do you get normal html output?

If the first case works but the second case fails with an error that the wrong user is running the script then you have a setuid problem. (This assumes you are running BackupPC_Admin without mod_perl, and you therefore need setuid to work. If you are using mod_perl then apache should run as user __BACKUPPCUSER__.)

First you should make sure the cgi-bin directory is on a file system that doesn't have the ``nosuid'' mount option.

Next, experiment by creating this script:

    printf("My userid is $> (%s)\n", (getpwuid($>))[0]);

then chown it to backuppc and chmod u+s:

    root# chown backuppc testsetuid
    root# chmod u+s testsetuid
    root# chmod a+x testsetuid
    root# ls -l testsetuid
    -rwsr-xr-x    1 backuppc  wheel          76 Aug 26 09:46 testsetuid*

Now run this program as a normal user. What uid does it print? Try changing the first line of the script to directly call sperl:


(modify according to your version and path). Does this work instead?

Finally, you should invoke the CGI script from a browser, using a URL like:


You should make sure REMOTE_USER is being set by apache (see the earlier section) so that user authentication works. Make sure the config settings $Conf{CgiAdminUserGroup} and $Conf{CgiAdminUsers} correctly specify the privileged administrator users.

Back to Top

I get the error ``Error: Unable to read or language strings!!''; how do I fix this?

Most likely this is a permissions problem. Most likely it means BackupPC_Admin isn't running as the backuppc user, so it cannot access the file.

Another thing to check is the file (which is stored under the BackupPC data directory) has the right permissions, and each of the directories above it can be read by the user that BackupPC_Admin runs as.

Back to Top

I get the error ``Only privileged users can...''; how do I fix this?

If you get the error

    Only privileged users can view information about host xyz

it means that BackupPC_Admin is unable to match the user's login name (supplied by Apache via the REMOTE_USER environment variable) with either that host's user name (in the conf/hosts file) or with the administrators specified in the $Conf{CgiAdminUsers} or $Conf{CgiAdminUserGroup} settings.

The most common problem is that REMOTE_USER is not set because the Apache authentication is not correctly configured. In this case BackupPC_Admin will report this additional error:

    Note: $ENV{REMOTE_USER} is not set, which could mean there is an
    installation problem.  BackupPC_Admin expects Apache to authenticate
    the user and pass their user name into this script as the REMOTE_USER
    environment variable.  See the documentation.

You should review the configuration instructions to setup Apache authentication correctly. To test if REMOTE_USER is being set correctly, there is a simple script called printenv that is included with Apache. This is a simple CGI script that prints out all the environment variables. Place this script in the same directory as BackupPC_Admin and run it with a URL like:


Check the value of the REMOTE_USER environment variable. Here's a copy of the printenv script:

    ##  printenv -- demo CGI program which just prints its environment
    print "Content-type: text/plain\n\n";
    foreach $var (sort(keys(%ENV))) {
        $val = $ENV{$var};
        $val =~ s|\n|\\n|g;
        $val =~ s|"|\\"|g;
        print "${var}=\"${val}\"\n";

Back to Top

SourceForge Logo
This page last modified 2004-06-26 22:23
© Copyright 2001-2005 Craig Barratt. BackupPC is hosted by SourceForge and distributed under a GPL license.