Setup Help

schnizaare's picture

Please forgive me if I'm posting this in an inappropriate place. I'm still new at interacting with the Drupal community. I am learning to setup webservers. Fun! I think I'm almost there, but need some help. Below is the situation as best as I can describe it:

****Software
Ubuntu 10.4
Vsftpd
Apache2
Phpmyadmin

****Relevant Users
admin
www-data (apache – I think)

****File structure
/home/admin/drupal6_root
/home/admin/drupal7_root

****Config Files
/etc/profile - added umask 002 at end of file
/etc/vsftpf.conf - adjusted local_umask=002

****Issue
I can transfer files via ftp as user admin perfectly.
When Drupal 7 tries to transfer files via ftp, it transfers some, but then can’t go the whole way. Gives me this error:
Failed: File Transfer failed, reason: Cannot create directory /home/admin/drupal7_root/sites/all/modules/weather/translations/

But…

It does create that directory, but then can’t get back out to create the other necessary files. It creates about 30% of the actual files and directories in the original zipped folder.

****Possible Solutions
Has anyone run across any issues like this? Do you know of any services that aid in solving issues like this or could you point me in the right direction? I’ve searched all over the net and can’t find a solution.

Comments

Testing file permissions

rfay's picture

To understand what goes on with file permissions, it's best to become the user that's having the problem and then see what happens.

In your case, on ubuntu, the user that's having the problem is www-data. You can become www-data with

sudo -u www-data -s

Then just try to write files in the directory in question.

A suggestion: You may want to set the umask in /etc/apache2/envvars, since /etc/profile is only run for shell users doing a login, which apache doesn't do.

Anyway, just try doing what Drupal is doing by manually becoming the user and performing the action, and you (hopefully) will understand what's going on soon.

This is just my day

schnizaare's picture

Thanks for the help and direction. I logged in successfully as www-data and uncompressed and moved a module (tar.gz file) to the directories without problem. I also changed the umask command as suggested. I'm attempting to use admin/modules/install from Drupal 7, but still keep failing. It looks like Drupal uses FTP, and my admin username and pass to attempt to login (asks me via a form for it) and do it all.

Do you think Drupal is logging into my ftp server as www-data or admin? Does www-data natively have a password to login as?

Thanks so much rfay for the help.

I know this is an old post,

iolartes's picture

I know this is an old post, but I would like to add my two cents if somebody gets here while researching this issue.

As far as I understand, the www-data is a group, not an user. To allow Drupal installation writes you have to give it writing permission to the sites/all directory. In Ubuntu you can use the chgrp username:www-data -R directoryname to change the group association to the directory name and its child directories. Remember to change username for a valid user name in your install.

Please notice that there is a security risk in this permission change. I don't understand the full implications, but this might be harmful on a production server. For development in a local server it should be ok.

www-data just group?

Scott M. Sanders's picture

www-data is both user and group.

So this fixed it for me: sudo chown -R www-data:www-data drupal

Be careful about security with this

syscrusher's picture

This is appropriate to do, but be sure to check the permission bits so that the web server can't write to the settings.php and related files, else that's a security hole. Not such a big deal on your local workstation for testing.