Help - Search - Members - Calendar
Full Version: linking directories
The Planet Forums > Control Panels > Plesk
JohnC
I'm trying to create a link to a directory of images. The link is across 2 different domains. When I try to create a hard link as SU I get an "operation not permitted error." When a create a symbolic link I have no access to the dir even though permissions are ok. Any ideas on how to do this?

I'm using Plesk 5.05 & redhat 7.3.
Mr. Popularity
if you're getting these errors from a PHP script, please understand that PHP doesn't play well with symlinks

C
x007
Symlink should work

Make sure the link you want to create doesnt exist already

for a directory (pointing httpsdocs to httpdocs) ex:

ln -sd /home/httpd/vhosts/xx.com/httpdocs /home/httpd/vhosts/xx.com/httpsdocs
JohnC
Thanks for the replies.

The errors are at the command line.

x007 - That command creates the directory with permissions of 777 but it won't let me access it.

Does it make a difference if it's 2 different sites

from: /home/httpd/vhosts/AAA.com
to: /home/httpd/vhosts/BBB.com
Mr. Popularity
in plesk? yes unfortunately, unless you're running some sort of script as root.

Explain your problem in COMPLETE detail, and I will come up with something that will work

C
JohnC
I need t create a link form site a to site b. It's a directory of images that needs to be accessed via http.
Mr. Popularity
ok, but a link in "what kind" of script? html, php, cgi/perl?

a symbolic link? is this an HTTP URL? or a /absolute/path/url ???

i have no idea what you're trying to accomplish
JohnC
Ok, sorry about that. I was trying to create a symbolic link in linux.
from: /home/httpd/vhosts/AAA.comhttpdocs/images/
to: /home/httpd/vhosts/BBB.com/httpdocs/images/

Basically I want the images to show on site B with site B's URL.

It's a large directory that's updated daily and works along with a mysql database so copying the images to all the sites would be alot of work.
Mr. Popularity
that is going to be a problem in Plesk!

PHP and symbolic links do not play well together, and thanks to the Plesk nazi's you cannot setup your domain to include files from outside your chroot
JohnC
Thanks for the help. I guess I'll just have to let site A's URL show as the source.
Galactic Zero
Or, copy the images to site b's folder, setup a cron job to run and script to check site A's images folder and have it mirrored on Site B's, checking for file date or size updates before copying from a to b.

Not a clean work around but should work in theory.
S3P
I don't know anything about plesk, so feel free to club me over the head, but I can't see what this has to do with anything except linux and apache. If you have images located in /home/httpd/vhosts/AAA.comhttpdocs/images and you want them to be accessible from BBB.com, as in /home/httpd/vhosts/BBB.comhttpdocs/images , then just:

ln -s /home/httpd/vhosts/AAA.comhttpdocs/images images

in the web root of BBB.com. Now any http requests for images folder in web root of BBB.com will pull them from AAA.com.

Does plesk somehow get involved in every http request and do some kind of filtering to prevent this kind of linking? Plesk systems still use apache, right? If I sound sarcastic, I don't mean to, I just don't know anything about plesk and am surprised this should be a problem.
JohnC
s3p
That's what I thought but for some reason it doesn't work. It lets me make the link nut then I can't access it. I have permission to access it, the directory shows via telnet & my ftp program. If I try to access it by ftp or http I get an error.

I've just got the images hotlinked now but I'd really like to find a way to set up the link.


Galactic Zero
Thanks for the suggestion. I may end up doing something like that but I need the new images to be there the instant the database is updated. That's why I just used an http link to site A for now.
S3P
What http error do you get?
x007
QUOTE
Originally posted by JohnC
s3p
That's what I thought but for some reason it doesn't work. It lets me make the link nut then I can't access it. I have permission to access it, the directory shows via telnet & my ftp program. If I try to access it by ftp or http I get an error.  

I've just got the images hotlinked now but I'd really like to find a way to set up the link.  



Make sure the link have owner permission may be.. make a chown whit the owner.. if you do a symlink you should do it whit root then chown to owner i think.. not tried but its a guess..
JohnC
S3P
I just have 1 generic error doc so I wasn't sure. When looked it up in my logs the error says: "Symbolic link not allowed"


X007
I hadn't thought of that. Owner was set to root. I changed it but the problems still there.


I looked this up on the Plesk FAQ and found this:

------------------------------
Is it possible to use symbolic links to other home directories on the server?

Yes, this could be possible but you must understand that the suexec wrapper and skeleton directories will not follow symbolic links.
-----------------------------


Is this most likely what's causing the problem?
S3P
That must be the plesk nazis Mr. Poplularity referred to. I don't know offhand a workaround for that.

Maybe you could try an alias in the VirtualHost container in Apache? That seems like it would work. Something like:

Alias /images/ /sourcedomain/www/images/

Edit: if you try that, be sure to delete the linux alias so it doesn't confuse matters.
JohnC
Thanks SP3 that worked. This is something new to me & I've got 2 more questions.

Alias /images/ /sourcedomain/www/images/
didn't work I had to use
Alias /images/ /home/httpd/vhosts/sourcedomain/httpdocs/images/
Do you think that could cause any problem?

Could you explain "delete the linux alias" a little more.




Thanks.....John.
S3P
QUOTE
Originally posted by JohnC
Alias /images/ /sourcedomain/www/images/
didn't work I had to use  
Alias /images/ /home/httpd/vhosts/sourcedomain/httpdocs/images/
Do you think that could cause any problem?

Could you explain "delete the linux alias" a little more.


I'm sorry, you did it the right way, I was using my rhe/cpanel www path as example. The path should of course be to where the docs are, not what I said. I get in a hurry sometimes. icon_smile.gif

What I meant was delete the symbolic link you created (ln -s /home... etc) so it wouldn't clash with the http alias. Once again my mind is moving slower than my keyboard. icon_smile.gif
JohnC
Ok, thanks again. I appreciate the help.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.