4

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?

4 Answers 4

14

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.)

1
  • 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, 2010 at 16:06
1

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/
0
0

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.

0

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.

You must log in to answer this question.