0

I want a FTP user to have access to homedir and also /var/www directory

I have installed vsftpd via yum command and give them access to homedir.

To have access to a homedir only, I've set chroot_local_user to YES in /etc/vsftpd/vsftpd.conf

I have tested it and it work fine, how to allow user to have access to /var/www as well and including write permission?

I'll-Be-Back
  • 693
  • 3
  • 9
  • 24
  • Is there a reason you can't simply change the DocumentRoot in Apache so that it is under the user's homedir? After all, /var/www is only a default, there's no reason it can't be changed generally speaking. – ThatGraemeGuy Sep 06 '13 at 07:34
  • @ThatGraemeGuy I don't need homedir web. Its for two developers can upload files to /var/www - default path. – I'll-Be-Back Sep 06 '13 at 08:08

1 Answers1

2

You may so-called bind or remount part of the filesystem hierarchy somewhere else. In your case, you can create a www directory in your user's home directory and bind required directory there (assuming you do this under root user or other privileged user who is capable to run mount command, e.g. via sudo):

mkdir ~some_user/www
mount -o bind /var/www ~some_user/www

When you ftp under this user you will be able to traverse the /var/www directory if the user have enough permissions.

dsmsk80
  • 5,757
  • 17
  • 22
  • Thanks, I will try that. What about `ln` command? – I'll-Be-Back Sep 06 '13 at 08:11
  • No, symlinks can't work with chrooted environments. I mean symlinks pointing outside of the chroot environment as a symlink is just a "path" pointing sowhere which is bound by the root directory which is user's home directory in this case. – dsmsk80 Sep 06 '13 at 08:18