I have a CentOS server machine and i installed vsftpd server following this article :
http://www.cyberciti.biz/tips/centos-redhat-vsftpd-ftp-with-virtual-users.html
I have created a virtual user but in vsftpd.conf i did the following:
local_root=/var/www/html
And after chowning the web root chown -R ftp:ftp /var/www/html
the permissions are like this:
drwxrwsr-x 4 ftp ftp 4096 Feb 22 17:28 .
drwxr-xr-x 10 root root 4096 Oct 21 00:05 ..
drwxr-sr-x 2 root ftp 4096 Feb 22 17:28 fromconsole
-rwxrwsr-x 1 ftp ftp 30 Feb 19 20:02 index.html
drwxrwsr-x 3 ftp ftp 4096 Feb 22 17:19 fromftpclient
As you can see, fromconsole
is folder created with mkdir
, fromftpclient
is folder created by FileZilla
And when i upload from a FTP Client (FileZilla), the folders are with ftp ownership, but if i create folder/files from the console, i cannot access them via the FTP client.
My question is – What is the best practice to do the thing with the FTP account and the apache web root ?
Best Answer
All that matters to apache is that it can read the files.
As long as the "other" group has read permissions on files and read+execute permissions on directories, apache will be able to serve the content.
As for the difference between FTP-ing a file and creating it as root - yes, obviously there is a difference, since you created it as root.
Don't do that, then.