Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

i have the backup archives in some linux folder.

/backups

Now i want make the web interface from which user can download those files.

is there any way that that i can have username and password and that user can download that file

Just like in cpanel

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

This will let you create the alias so that http://127.0.0.1/backups will work.

Alias /backups "/backups"
<Directory "/backups">
    AllowOverride None
    Options Indexes
    Order allow,deny
    Allow from all
</Directory>

To turn on password prompts, put the following in /backups/.htaccess:

[kevin@box backups]$ cat .htaccess
AuthType Basic
AuthName "_password prompt text_"
AuthUserFile /var/www/conf/backup-user-file
AuthGroupFile /var/www/conf/backup-group-file
Require group backup-users
[kevin@box backups]$

The backup group file, equivalent to /etc/group, can just be created.

[kevin@box choir]$ cat /var/www/conf/backup-group-file
backup-users: backup-user-1 backup-user-2

The backup user file must be created using the htpasswd utility. The first time you run it, you will need to do so with the -c(create a new file) option.

[kevin@box backups]$ htpasswd -c /var/www/conf/backup-user-file backup-user-1
New password:
Re-type new password:
Adding password for user backup-user-1
[kevin@box backups]$ htpasswd /var/www/conf/backup-user-file backup-user-2
New password:
Re-type new password:
Adding password for user backup-user-2
[kevin@box backups]$
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.