Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a user which is chrooted to her home directory, but I want her to also be able to manage files within /var/www. As such, I did the following:

root@server:/home/username# ln -s /var/www www
root@server:/home/username# cd www
root@server:/home/username/www# chown username:username *

However, when I try to open /www with FileZilla it returns "no such file or directory". I can see the linked directory, but I can't access it. What am I doing wrong?

share|improve this question
up vote 30 down vote accepted

Symlinks are essentially just pointers to another file, you can't point to something outside the chroot because it is looking for a file with that name (/var/www, which doesn't exist inside the chroot). Hardlinks on the other hand are pointers to the inode. As such, if you want to do that, you need to use a hard link by omitting -s. However, you cannot hard link a directory (other than . and ..) in Linux for a variety of reasons (the main one being that those filesystems are a DAG).

Perhaps the best way would be to use a bind mount. Try this:

mount --bind /var/www /home/username/www
share|improve this answer
ln: '/var/www': hard link not allowed for directory – Doc Nov 14 '12 at 15:53
@Doc - Directories cannot be hard linked in Linux. A bind mount should work. – Chris Down Nov 14 '12 at 16:03
it worked! thank you! – Doc Nov 14 '12 at 16:04

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.