Home : Linux : Red Hat 9 : User Directories

How to browse using ~user in Redhat 9.0

In order to be able to browse a user's www folder (or public_html) by using ~user you must do two things:

  1. Configure apache to allow userdir to do this
  2. Reset permissions of the users home dir and public_html dir

1) To configure apache to allow ~userdir

First you have find the following part in the Apache config file, /etc/httpd/conf/httpd.conf. (It will be around line 350 to 380)
TIP: If you are editing with vi, hold down <ctrl> and press g to see what line you are on

# UserDir is disabled by default since it can confirm the presence
# of a username on the system (depending on home directory # permissions).
#
UserDir disable
#
# To enable requests to /~user/ to serve the user's public_html
# directory, remove the "UserDir disable" line above, and uncomment
# the following line instead:
#
#UserDir public_html

You need to edit two of the lines.

  1. Comment out the line UserDir disable (put a # at the beginning). This enables userdir.
  2. Uncomment the line UserDir public_html (remove the #). This sets the users dir to /home/~user/public_html

2) Reset permissions of home and public_html directories

It is recommended that you chmod /home/~user to 755 (although I have found 701 is all you need)
You must also chmod /home/~user/public_html to 755.

You will need to restart apache now.
Type /etc/init.d/httpd restart.