Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Server
User Name
Linux - Server This forum is for the discussion of Linux Software used in a server related context.


  Search this Thread
Old 04-26-2008, 05:09 AM   #1
LQ Newbie
Registered: Mar 2008
Posts: 18

Rep: Reputation: 0
Question Permission problem on user directory


I am using centos 4.4 linux and running apache web server, everything is find, but when I create test.html on user home page, it should permission problem as below:

You don't have permission to access /~sam on this server.

Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.
Apache/2.0.52 (CentOS) Server at Port 80


I have enable access permission on user's directory as below but still have problem:

[sam@centos home]$ ll
total 32
drwx------ 3 patrick users 4096 Apr 24 11:30 patrick
drwxr-xr-x 4 sam sam 4096 Apr 26 12:58 sam
[sam@centos home]$

[sam@centos ~]$ ll
total 8
drwxr-xr-x 2 sam sam 4096 Apr 26 12:59 public_html
[sam@centos ~]$

As for the file "httpd.conf", UserDir setting was enabled as below:

<IfModule mod_userdir.c>
#UserDir disable

UserDir public_html

<Directory /home/*/public_html>
AllowOverride FileInfo AuthConfig Limit
Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
Order allow,deny
Allow from all
Order deny,allow
Deny from all


I am sure apache is running because it can show the testing page on http://localhost/

Is there any further settings I need to configure?
Old 04-26-2008, 06:41 AM   #2
LQ Guru
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 677Reputation: 677Reputation: 677Reputation: 677Reputation: 677Reputation: 677
I don't think that the file permissions on a user directory would allow the apache system user to access the file. It would be better to configure the server normally and give the user access to the directory used for the server pages, such as /srv/www/ or /srv/www/patrick/public_html for example. If you want only certain users access to this directory or directories, consider using ACLs.

sudo mkdir /src/www/patrick/public_html
sudo setfacl -m u:patrick:rwx /srv/www/patrick/ /srv/www/patrick/*
getfacl patrick/ patrick/*
# file: patrick
# owner: root
# group: root

# file: patrick/cgi-bin
# owner: root
# group: root
You could create a symbolic link to such a directory for each user. Then from their standpoint, everything would be the same.


If the service runs as root, you might want to check the selinux settings and logs.

Last edited by jschiwal; 04-26-2008 at 07:00 AM.
Old 04-26-2008, 07:19 AM   #3
LQ Guru
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298

Rep: Reputation: 75
It could be a problem with selinux. Try the following
#chcon -R -h -t httpd_sys_content_t /home/usr/public_html
Old 04-26-2008, 07:59 AM   #4
LQ Newbie
Registered: Mar 2008
Posts: 18

Original Poster
Rep: Reputation: 0
thanks jschiwal and reddazz, I will try it.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Add User Permission to Directory anjanesh Linux - Newbie 3 12-29-2007 10:28 AM
How can I set the permission on the home directory when creating an user crisostomo_enrico Solaris / OpenSolaris 4 09-26-2007 06:24 PM
Give the root Permission to other user for manage File/Directory shipon_97 Linux - Newbie 2 01-28-2007 11:46 AM
Permission denied existing directory root/user BDHamp Linux - General 5 04-10-2006 09:41 AM
Sharing a directory with a regular user (with write permission) Ironica Linux - Newbie 6 05-31-2004 11:27 AM > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 10:12 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration