Just installed vsftpd. What is the best way to give a user access to /var/www?

March 7, 2015 3.1k views
Security Getting Started LEMP Configuration Management Nginx

Many nginx tutorials say to make ownership of /var/www belong to www-data:www-data but tutorials on vsftpd say to make ownership that of the user you’re using to login via FTP.

So which is the best way to give an FTP user to read/write in /var/www?

1 Answer

If it’s the best way it’s arguable, but if I remember it right I added my ftp users to the www-data group, created a folder for the user in the /var/www/ and gave him its ownership, setting permissions accordingly.

  • I suppose that works, but if I set the owner of my web accessible directories to my user then I can FTP anywhere just fine like I want, but nginx can’t serve pages. If I change ownership of folders to www-data then nginx serves them fine but I can’t FTP make changes there anymore. If I do what you’re saying and just make a folder for my user then I can put stuff there but have to go in via SSH I guess and move it to the folders owned by the www-data user which is just a hassle.

    I guess the solution is to make nginx run as my user, which there are some directions online I’ll look into.

  • And that’s what adjusting permissions is for.

Have another answer? Share your knowledge.