Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

HTTP/CGI Backup interface w/Perl

by Anonymous Monk
on Jun 09, 2003 at 23:43 UTC ( #264491=perlquestion: print w/replies, xml ) Need Help??
Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hello, I would like to create a HTTP/CGI interface to backup my directories and then initiate a download via the browser.
I can come up with the script to allow me to choose the directories and initiate the commands. I don't know how to return the resulting file to the browser.
Can anyone point me in the right direction? Thanks.

Replies are listed 'Best First'.
Re: HTTP/CGI Backup interface w/Perl
by sauoq (Abbot) on Jun 10, 2003 at 00:03 UTC
    #!/usr/bin/perl $|++; my @files = qw( /home/sauoq ); print "Content-type: application/x-tar\n\n"; system( "tar cvf - @files" );
    -sauoq
    "My two cents aren't worth a dime.";
    
      Yup. Don't do anything silly like system("tar cvf - $my_user_input_from_a_form");, unless you want to hand out tar files of your server's passwords, though.

      andramoiennepemousapolutropon

        This is very good advice and I was remiss in not noting such myself. That said, you should also know that, if you did so, you might risk a whole lot worse than the loss of your password file. It would permit a user to run any arbitrary command on your system with privileges the same as those that the cgi script runs with.

        Know the risks, understand the issues, and use the -T option to help you catch dangerous code.

        -sauoq
        "My two cents aren't worth a dime.";
        
•Re: HTTP/CGI Backup interface w/Perl
by merlyn (Sage) on Jun 10, 2003 at 00:42 UTC
Re: HTTP/CGI Backup interface w/Perl
by iguanodon (Priest) on Jun 10, 2003 at 09:41 UTC
    This doesn't directly answer the question, but for a complete backup solution including a web interface to download backups, see BackupPC.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://264491]
Approved by sauoq
help
Chatterbox?
[Discipulus]: thanks choroba.. todo list need a pager..

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (11)
As of 2017-11-24 12:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:













    Results (348 votes). Check out past polls.

    Notices?