Ubuntu – chown: changing ownership of `…’: Operation not permitted

installationWordpress

I'm trying to install WordPress using the following installations. However, when I attempt to open the browser to set up WordPress, I get an error that there is a problem establishing a database connection. I think it's because of an error I get when I run the chown command.

http://www.techkaki.com/2011/04/how-to-install-wordpress-locally-on-ubuntu-10-10-with-lamp/

chown -R www-data /var/www/wordpress

I get a ton of error messages:

...
chown: changing ownership of `/var/www/wordpress/wp-admin/network/themes.php': Operation not permitted
chown: changing ownership of `/var/www/wordpress/wp-admin/network/users.php': Operation not permitted
chown: changing ownership of `/var/www/wordpress/wp-admin/network/index.php': Operation not permitted
chown: changing ownership of `/var/www/wordpress/wp-admin/network/sites.php': Operation not permitted
chown: changing ownership of `/var/www/wordpress/wp-admin/network/user-new.php': Operation not permitted
chown: changing ownership of `/var/www/wordpress/wp-admin/network/setup.php': Operation not permitted
chown: changing ownership of `/var/www/wordpress/wp-admin/network/theme-install.php': Operation not permitted
chown: changing ownership of `/var/www/wordpress/wp-admin/network/plugins.php': Operation not permitted

Anyone know what's up with this?

Best Answer

You have to be root to change the owner of files/directories.

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

If you're getting an error like Operation not permitted, just type:

sudo !!

at the prompt to execute the last command with root priviledges. This way, you don't have to retype chown -R www-data /var/www/wordpress.