Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Hello im having a problem with a project of mine, i have ubuntu server 12.04.1 lts, the problem i'm having is that i everytime i upload a file through ftp i need to modify file permissions otherwise it isnt available through browser.How can i modify the /var/www folder permissions to be seen by public through web browser and every new file/directory have the permissions of the www directory?

share|improve this question

2 Answers 2

up vote 1 down vote accepted

You need to change your FTP account to be a member of the www-data group. (You could also set it to USE the www-data account.)

Details of how to do this change dramatically depending on what FTP daemon you're using.

share|improve this answer
    
thanks for responding,im using vsftpd, are o able of giving more details? –  adi Nov 26 '12 at 10:16
    
managed to solve it with your answer thank you. used sudo usermod -g www-data "user" and uncommented unmask from vsftpd.conf it helped –  adi Nov 26 '12 at 11:29

I would go with Jim Salter answer in general. It should be fast to configure.

Just as a reference I had to build a server with plenty of users accessing via different processes and several daemons that I do not want to run as root. I decided to use acls.

The steps are the following:

  1. Install the acl package

  2. Add support in your filesystem:

Edit /etc/fstab and add acl as a keyword in your partition. Something like this:

UUID=b8c490d0-0547-4e1f-b052-7130bacfd936 /home ext4 defaults,acl 0 2

  1. Restart o remount.

  2. Set the acl on the directory:

    sudo setfacl -Rdm u:www-data:rx /var/www

This will make every file created in that directory to inherit this permissions (in practice, adding www-data as the group instead of that users group.

It should work for you too if you can't find the way in your FTP (which, again, should be easier)

References: http://brainstorm.ubuntu.com/idea/24052 http://brunogirin.blogspot.com.es/2010/03/shared-folders-in-ubuntu-with-setgid.html

share|improve this answer

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.