LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


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

Rep: Reputation: 0
Question Permission problem on user directory


hi,

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 192.168.74.2 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:

httpd.conf
------------------------------------------------------------------------
<IfModule mod_userdir.c>
#UserDir disable

UserDir public_html
</IfModule>

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

------------------------------------------------------------------------

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, 07:41 AM   #2
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 671Reputation: 671Reputation: 671Reputation: 671Reputation: 671Reputation: 671
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.

Code:
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
user::rwx
user:patrick:rwx
group::r-x
mask::rwx
other::r-x

# file: patrick/cgi-bin
# owner: root
# group: root
user::rwx
user:patrick:rwx
group::r-x
mask::rwx
other::r-x
...
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 08:00 AM.
 
Old 04-26-2008, 08:19 AM   #3
reddazz
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
Code:
#chcon -R -h -t httpd_sys_content_t /home/usr/public_html
 
Old 04-26-2008, 08:59 AM   #4
vvcat
LQ Newbie
 
Registered: Mar 2008
Posts: 18

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


Reply


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 11:28 AM
How can I set the permission on the home directory when creating an user crisostomo_enrico Solaris / OpenSolaris 4 09-26-2007 07:24 PM
Give the root Permission to other user for manage File/Directory shipon_97 Linux - Newbie 2 01-28-2007 12:46 PM
Permission denied existing directory root/user BDHamp Linux - General 5 04-10-2006 10:41 AM
Sharing a directory with a regular user (with write permission) Ironica Linux - Newbie 6 05-31-2004 12:27 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

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

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