LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Apache forwarding users to their homedirs (https://www.linuxquestions.org/questions/linux-newbie-8/apache-forwarding-users-to-their-homedirs-193818/)

ashembers 06-15-2004 12:37 PM

Apache forwarding users to their homedirs
 
Hi there!

I am fairly new to Apache, but would like to make a simple HTTP download server using either myown PHP or the nice WebFileBrowser script set.

Here are my questions:

1) Would someone be good enough to point me in the direction of where I can make a decent login page?

2) I also need a pointer about where I can find more info about how Apache forwards a user to their home directory.

Thanks for your time!

Dan

Donboy 06-15-2004 01:09 PM

I think you want to look at using userdir options in apache. Just look for the httpd.conf file somewhere on your machine. Edit this file. Look for the section that talks about userdir's. You should also search the apache website. There is a nice howto on there that explains how to setup userdir's so you can enter a URL like http://yourdomain.com/~yourname and it will take the browser to a user's home directory.

tjmalone 06-15-2004 02:39 PM

home dirs
 
each user needs a foler public_html,

in the /etc/http/conf/http.conf

set servername to the server name.

put a hash, in front of disable user_dir,
delete the one in front of enable user_dir

restart httpd

then each user must do these two steps.
then for each user chmod 711 user_home_dir
then for each users publiv_html chmod 755 -R public_thml

ashembers 06-16-2004 05:44 PM

OK, I see that. Thanks - that will work.

So how do users log in? Keep in mind, I'd like to make a login page of some sort.

Donboy 06-16-2004 11:48 PM

Well, that's another can of worms. Shown below is the method I'm using. I'm absolutely sure somebody will come along behind me with another method that is better or simpler, but this is just what I'm using because its convenient for me and I can use an automated script to make these whenever I need.

First, create a file (called .htaccess) that looks like this...

Code:

AuthUserFile /path/to/your/.htpasswd
AuthGroupFile /dev/null
AuthName "Whatever You Want"
AuthType Basic

<Limit GET>
require user yourusername
#END
</Limit>

Put the above file in the directory where you want password protection. The /path/to/your should be the location of where you want to store the password file that we will create later. This can be in the same location as the .htaccess file, but many people recommend it be placed somewhere outside the document root. Personally, I think this kind of security isn't very strong and should not be used if you're trying to secure something extremely important like bank account info. If you're going to secure something that important, you really need to use SSL with this too. The "yourusername" should be whatever username you want people to enter when they login.

Now create another new file (mine is called "crypt_pass.pl") and put this inside...

Code:

#!/usr/bin/perl

($password, $salt) = @ARGV;
$password or die "usage: mycrypt password [salt]\n";
$salt = "cc" unless $salt;
$cryptpw = crypt($password,$salt);
print "$cryptpw";

This script will take your input and encrypt it. What it outputs is the encrypted version of whatever you input. Usage is like this. "./crypt_pass.pl password". What the script returns is an encrypted version of "password".

Now take the output and use it in another file... This file is called .htpasswd....

[code]
yourusername:cryptedoutput
[code]

Where "yourusername" is whatever you used in the .htaccess file above and "cryptedoutput" is whatever crypt_pass.pl generated for you.

I really recommend searching for info about .htaccess and .htpasswd and see how other people suggest doing it. LIke I said, there are a lot of ways you can do this, and there are bound to be ways that are better or simpler for you.

ashembers 06-17-2004 09:16 AM

Donboy,

OMG, that is a lot of thought you have just given me. Can I buy you a pizza? I will try it out & let you know how it goes...


All times are GMT -5. The time now is 02:54 AM.