Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I've tried the ln -s directory_to_use directory method, but all it does is just create a "file" that links to directory_to_use, which doesn't work when using FTP.

What I'm looking for is, for example, cPanel's www directory points to public_html as a symbolic link (www itself is a directory), both listing the same contents.

Does anyone know how to create that sort of symbolic link?

share|improve this question

4 Answers 4

There's only one kind of symbolic link.

The issue you're seeing with FTP is probably that the FTP server is restricted to a subtree of the filesystem (this is called a chroot jail), and a symbolic link pointing outside that subtree won't work. That's by design: the chroot jail is for security, and you mustn't be able to escape the jail by following a symbolic link.

Arrange for all the files you'll ever need to access with FTP to be in the jail. Symbolic links will work as long as they don't try to escape the jail.

(If you are root on the machine, there are ways to make more files accessible within the jail, but I don't recommend fiddling with this if you don't understand all the issues.)

share|improve this answer
1  
Even if it's not a chrooted ftp server, chances are the server is configured to not follow symlinks at all, or otherwise restricted on what it can do via e.g. SElinux policies. –  nos Aug 3 '10 at 16:06

If you have chroot issues and really do want to make the files accessible in another directory, hard links may be the solution. Keep in mind that by creating hard links in that directory, you are exposing the files you link to (presumably that's okay)

To create a hard-linked copy of directoryA as directoryB/directoryA (assuming directoryB exists already), you would use:

cp -rl directoryA directoryB/

example:

mkdir /var/dupe
cp -rl /var/log /var/dupe/
share|improve this answer
    
This worked for me. Thanks so much! –  Kevin Duke Oct 20 '12 at 1:01

generally it works. maybe you should check the permissions.

for example in your case, check apache's error_log. propably it says that you don't have access.

share|improve this answer

You are misunderstanding the problem

Most likely, the issue is that your FTP account is chroot'd and just cannot change to the directory indicated by the symbolic link. Most FTP clients should have support for symbolic links, most usually even display it with a special icon indicating that it is a link. If your FTP client is not working, try the open source client FileZilla, it is very good.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.