LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   vsftpd configuration for web server - newbie (https://www.linuxquestions.org/questions/linux-server-73/vsftpd-configuration-for-web-server-newbie-478066/)

adagio 08-28-2006 08:50 AM

vsftpd configuration for web server - newbie
 
Distro Dapper Drake
I want to set up a web server. I have managed to configure Apache to serve files generated on the server, I can upload using ftp to \var\www with a local username and password. Problem - file permissions are wrong and Apache returns
"Forbidden
You don't have permission to access /index.html on this server."

I can manually (on the server) modify the permissions to correct the problem but clearly this is a pain to do each time to each file.
How can I configure vsftpd such that the correct permissions are allocated?

blankbmx 08-28-2006 11:41 PM

You might want to do something like this:

Add the user that you are logging into FTP as to a group, let's say "administrators."

Code:

# usermod -g administrators (username)
You can then modify the permissions of the "/var/www" directory to be writable by owner and group, like such:

Code:

# chmod 775 /var/www
And then finally, make "/var/www" part of the administrators group:

Code:

# chgrp administrators /var/www
This way the files that you upload should be uploaded as part of the administrators group, and apache will be able to serve the files just fine.

adagio 08-29-2006 04:39 AM

Thank you for taking the trouble to respond to my query. I believe that I have done as you suggest with the user 'david'. The directory \var\www has the properties:

Quote:

drwxrwxr-x 3 david administrators 4096 2006-08-29 10:15 www
the uploaded files have the properties:

Quote:

-rw------- 1 david administrators 3636 2006-08-29 10:34 index.html
-rw------- 1 david administrators 6425 2006-08-29 10:34 profiles.htm
-rw------- 1 david administrators 9602 2006-08-29 10:34 tours.htm
Apache will not serve them.

adagio 08-29-2006 05:02 AM

Further to above the Apache error log reports:

Quote:

[Tue Aug 29 10:40:13 2006] [error] [client 192.168.0.3] (13)Permission denied: file permissions deny server access: /var/www/index.html

blankbmx 08-29-2006 11:07 AM

try looking in /etc/vsftpd/vsftpd.conf, and see if there is a line that says:

Code:

local_umask=077
If this is set to 077, try setting it to 022.
You must then restart the vsftpd service. Depending on whether you have it set to start up in standalone mode or not, you will have to run one of the following commands:

/etc/init.d/vsftpd restart (for standalone mode)
/etc/init.d/xinetd restart

Files should be uploaded with read permissions for everyone. Thus allowing apache to server your files.

adagio 08-29-2006 12:11 PM

Thanks again. However, in the last 15 minutes I have just made the following change to apache2.conf.


Quote:

# the lines below were the original
# User www-data
# Group www-data

# added by david 29/08/2006
User david
Group administrators
everything works wonderfully well!

blankbmx 08-29-2006 01:05 PM

i see, so now apache is running as user david:administrators. that works too. but you will probably encounter the same problem if your try to upload any files as a different user in the future. just a heads up.


All times are GMT -5. The time now is 03:36 AM.