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.

I backed up my /var/www/wordpress folder to my external harddisk and restored it back. Now when I add a new plugin I am asked for ftp access to my localhost. I wonder why ?

As far as I could go /var/www/wordpress and its subfolders/files are own'ed by root. I have logged in to my wordpress as admin root.

I dont know why I need to setup ftpd, but I tried that too. here

I am missing something really silly here.

share|improve this question
1  
I'm not familiar with Wordpress but it doesn't surprise me that it requires ftp access to install a plugin--otherwise you would be giving your webserver permission to create/delete files... A bad idea. On another note, you probably should have your files owned by root. Have them owned by any old user and then giving the www-data group (Apache) read access is much more secure. I've had great luck using vsftpd for installing/updating Drupal modules, if you desire I can give you some info on how to set this up. –  adempewolff Jun 9 '12 at 4:13
    
Thanks, ran "cd /var/www/wordpress" and "sudo chown -R www-data:www-data wordpress". It worked. –  Siddharth Jun 9 '12 at 10:52
1  
Glad it worked, but I'm not sure how good having them owned by the user www-data is... I usually just have them owned by the group www-data. –  adempewolff Jun 9 '12 at 11:43
add comment

1 Answer

up vote 1 down vote accepted

During the development on WordPress, giving www-data write access on your files can make your life a lot easier,

The reason is for the fact that the admin panel of WordPress allows you to do easily change lots of configuration, create the .htaccess for you with the correct rewrite rules (depending on how you want your permalinks), install and configure plug-ins, you even have access to an editor which allows you to edit your CSS and PHP files.

Although, the editor is not that important when you have access to the files. As an IDE would be a much better choice, but as for the other functionalities it can prove to be useful sometimes.

So to summarize, the best configuration, in my opinion, would be to give user ownership to root and group ownership to www-data.

sudo chown -R root:www-data /var/www/wordpress

Then give write access to www-data during development:

sudo chmod -R g+w /var/www/wordpress

Once you are done with development, you should revoke the write access from your files to www-data and only give write access on the uploads folder. (This is where files that are uploaded from the admin end up)

sudo chmod -R g-w /var/www/wordpress
sudo chmod -R g+w /var/www/wordpress/wp-content/uploads

And finally just to make sure, it is best to revoke all permissions from other (This can even be done during development):

sudo chmod -R o-rwx /var/www/wordpress
share|improve this answer
    
Neat, this was the answer I was looking for. –  Siddharth May 4 '13 at 10:24
    
@siddharth Sorry I had the wrong uploads directory all along. I've fixed that now. –  Dan May 21 '13 at 20:57
add comment

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.