Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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 ?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

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.

share|improve this answer
    
So, if i want to deploy something, i should go with ftp user/group and not root ? :) –  Radoslav Georgiev Feb 23 '12 at 11:29
    
Certainly. since root-owned content can't be edited by non-root users later, this is not very efficient for uploadable web content. –  adaptr Feb 23 '12 at 11:31
    
Okay, thanks, that seals the deal for me ;) –  Radoslav Georgiev Feb 23 '12 at 16:48

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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