Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place! |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
02-12-2013, 05:08 AM
|
#1
|
LQ Newbie
Registered: Nov 2012
Posts: 8
Rep: 
|
Apache 403 file permission error when accesing a symlink file (CentOS 6.3)
Hello,
When trying to access a file outside the server document root directory, i get the 403 permission error.
It is a plain text file which i link with:
ln -s /home/blah/blah.txt /var/www/html/.
Since this is a lack of understanding(thus very common on Google) on my part, i have tried the following:
1) Checking the FollowSymLinks option in the httpd.conf file for the document root directory (already there)
2) Changing the permission (755) to the whole path leading to the file.
3) Adding the username "apache" to the group "users"
4) Initialising httpd.conf file as one of the members of the group "users"
5) Turning off SELinux
6) Praying
I know this is a fairly common question(embarassingly), but i've yet to find a solution.
Any help is much appreciated.
Regards,
Marko
|
|
|
02-12-2013, 05:22 AM
|
#2
|
Senior Member
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,800
|
I guess your purpose is to create a soft link named /home/blah/blah.txt for /var/www/html/, which you done as,
Code:
~$ ln -s /home/blah/blah.txt /var/www/html/.
But it's not correct.
Link command has following syntax (see more here),
Code:
ln [OPTION]... [-T] TARGET LINK_NAME
So you should try like,
Code:
~$ ln -s /var/www/html /home/blah/blah.txt
Where, /var/www/html is your target directory and /home/blah/blah.txt is link name. You can further verify the soft link as,
Code:
~$ ls -li /home/blah/blah.txt
lrwx ......... /home/blah/blah.txt -> /var/www/html
|
|
|
02-12-2013, 05:32 AM
|
#3
|
LQ Newbie
Registered: Nov 2012
Posts: 8
Original Poster
Rep: 
|
Sorry i don't want to be rude, but i think you've got it the other way around.
The way you did it is created a blah.txt link to the folder /var/www/html.
I want the link to point to the blah.txt ( in my case folders with images ):
# ll /var/www/html/blah.txt
lrwxrwxrwx. 1 root root 29 2013-02-12 10:38 blah.txt -> /home/blah/blah.txt
|
|
|
02-12-2013, 07:27 AM
|
#4
|
Senior Member
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,800
|
My purpose was to point out the correct syntax. In your first case, it was not correct. You could have done it like,
Code:
~$ ln -s /home/blah/blah.txt /var/www/html/linkname
~$ ls -li /var/www/html/blah.txt
lrwxrwxrwx 1 root root 29 2013-02-12 10:38 /var/www/html/linkname -> /home/blah/blah.txt
BTW, has it solved your problem?
Last edited by shivaa; 02-12-2013 at 07:28 AM.
|
|
1 members found this post helpful.
|
02-12-2013, 09:03 AM
|
#5
|
LQ Newbie
Registered: Nov 2012
Posts: 8
Original Poster
Rep: 
|
Hmm, im not sure how my first post was different from your last one...
But no, it is still not working.
|
|
|
02-12-2013, 10:30 AM
|
#6
|
Senior Member
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,908
|
Depending on distribution, the usual problem is that /home/blah/blah.txt that is pointed to by the symbolic link is not accessible by apache. The file (and the directory path it is in) must be accessable (rx for directories, and r for the file) in either group or world. The file must be in the apache group for group access (the directory path may be rx for group, IF the group is also apache, or world).
On RH systems with active SELinux controls the file must also be labeled with the SELinux labels (either httpd_sys_content/httpd_sys_rw_content, or httpd_user_content/httpd_user_rw_content) types.
|
|
1 members found this post helpful.
|
02-13-2013, 02:46 AM
|
#7
|
LQ Newbie
Registered: Nov 2012
Posts: 8
Original Poster
Rep: 
|
Thank you for your time shivaa and jpollard.
I solved the problem by actually reading an Apache/SElinux manual...
The first step was to enable reading of the home directories:
Code:
setsebool -P httpd_enable_homedirs 1
Then assign a proper type to the directory where the files reside:
Code:
chcon -R -t httpd_sys_content_t ~user/public_html
Finally linking the files which are to be used.
Thank you once more for your time.
|
|
|
02-13-2013, 03:25 AM
|
#8
|
Senior Member
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,800
|
Happy to hear that
Please Mark the thread as solved (option is under Thread Tools on top menu), if you think it has so.
|
|
1 members found this post helpful.
|
All times are GMT -5. The time now is 07:43 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|