I want to have ftp user who have only access to /var/www and work on all of files, but the problems arise when I give permission to /var/www, exactly chown. I try with chgrp but then I cannot edit files. I hope that you see my problem, so can I please you to give me some advice how to solve my problem or give me other solution.

I am using apache2, php5, mysql and proftpd.


1 Answer 1


This is the way, I did it:

  • create new user newftpuser:

    adduser newftpuser

  • create new group caneditwww:

    addgroup caneditwww

  • add newftpuser to that group:

    usermod -a -G caneditwww newftpuser

  • change group ownership for all files and dirs in /var/www:

    chgrp -R caneditwww /var/www

  • modify group permissions on /var/www, so group members can modify the content:

    chmod -R g+w /var/www

  • optionally mount directory /var/www to home directory of newftpuser:

    mkdir /home/newftpuser/www
    mount /var/www /home/newftpuser/www -o bind`

Now, after login, newftpuser can edit everything in /var/www, which he finds in /home/newftpuser/www.

  • 1
    This is almost certainly a horrible idea. What if you have more sites set up in /var/www? This is standard practice on large servers. You have now given write access to everything to that one user and anyone else in the new group.
    – terdon
    Jul 4, 2019 at 10:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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