How to set permission to ftp-user so that has FTP access to /home/another-user/www/public_html folder?

1

I'm a novice with Linux/Unix. Basically I'm attempting to setup a Web server, and FTP server on a Linux box via SSH.

My plan is to have Apache's root folder inside the main user account like

/home/giuseppe/www/public_html

and have an ftp-user account which should have rw- access via FTP to /home/giuseppe/www/public_html

I'm still not able to have the ftp-user being able to access the public_html directory in the home folder of the other account.

When I connect via FTP using the ftp-user, it defaults to its home directory.

These are the steps I have taken so far:

  • I have installed vsftpd and edited /etc/vsftpd/vsftpd.config ports and so on so that I'm able to connect with the ftp-user account. I've also set the local_root=/home/giuseppe/www/public_html/

  • I have restarted the vsftpd service after any config changes.

  • I have added a group named developers

  • I have made ftp-user member of developers, so that id ftp-user gives:

    uid=500(ftp-user) gid=502(developers) groups=502(developers)

  • I've changed the group of public_html with chgrp developers /home/giuseppe/www/public_html/

However, every time I connect via FTP the ftp-user account has rw- access to its own home folder only.

As I test I have added a symlink ln -s /home/giuseppe/www/public_html /home/ftp-user/. While I can see the symlink in the ftp-user home directory, I'm not able to navigate through the public_html symlink. Here is Filezilla's status log when I double click the symlink:

Status: Retrieving directory listing...
Command:    CWD /home/ftp-user
Response:   250 Directory successfully changed.
Command:    CWD public_html
Response:   550 Failed to change directory.
Error:  Failed to retrieve directory listing
Status: Starting download of /home/ftp-user/public_html
Command:    PASV
Response:   227 Entering Passive Mode (XXX,XXX,XXX,XXX,4,14).
Command:    RETR public_html
Response:   550 Failed to open file.
Error:  Critical error

Is my planned setup sensible or would you setup things differently?

Giuseppe Romagnuolo

Posted 2011-08-26T22:20:26.407

Reputation: 145

I suppose it would be safe to assume that you chmod'd the directory, but it would be nice to see what permissions the folder has with an ls -l. – digitxp – 2011-08-27T00:01:05.197

Yes I did give group permission and ls -l would have given drwxrwx--- 5 giuseppe developers 4096 Aug 27 01:30 public_html – Giuseppe Romagnuolo – 2011-08-27T12:08:00.863

Since the post I have changed my plan and eventually got things working. I have chroot() in vsftpd.config, then I have mounted the ftp-user home directory to the /home/giuseppe/www/public_html. I have then also mounted the /var/www/html to /home/giuseppe/www/public_html. Then I have made apache user and apache group drwxrwx of /home/giuseppe/www/public_html, and finally added ftp-user to the apache group. This seems to work, I've got hints from Apache docs where it mentions using mountpoints. – Giuseppe Romagnuolo – 2011-08-27T12:27:56.900

No answers