Centos – FTP to /var/www CentOS

apache-2.2centos

I'm configuring an Apache server under CentOS 6.3. I want to put my app in

/var/www/html/<myApp>

But that directory is owned by root. How can I properly configure the access so I can publish files to that directory from a FTP client?

Initially I wanted to put my files under /home/myApp/wwwroot but that gives error messages as it seems under CentOS you're supposed to put your files under /var/www/html

What would be the right way of configuring this?

Best Answer

My suggestion is:

  • Create the /var/www/html/YOUR_SITE directory, and own to your ftp user
  • Make sure /var/www/html/ have the 755 permission;
  • Create one user(please, dont use the ftp system user already created) and give the "ftpshell" to him. The home directory shall be /var/www/html/YOUR_SITE;
  • Configure your favorite ftp daemon(mine is vsftpd) to chroot by default to the home folder. Read the docs ;)

Done. When you connect through ftp, it will seems to be that you are at /, and your user will not navigate on the entire filesystem hierarchy.