I'm experiencing strage problem. I simple need to give permissions www-data to a folder

chown -R www–data:www-data /somefolder chown: invalid user: ‘www–data:www-data’ grep www-data /etc/passwd www-data:x:33:33:www-data:/var/www:/bin/sh 

other folders generated by apache:

drwxr-xr-x 2 www-data www-data 16384 Jan 12 00:30 11 drwxr-xr-x 2 www-data www-data 8192 Jan 13 01:01 12 drwxr-xr-x 2 www-data www-data 8192 Jan 14 00:30 13 
7

4 Answers

Looking at what I assume is a copy paste:

chown -R www–data:www-data /somefolder 

It should be noted that the hyphen in the user name is not a hyphen, but ASCII 150, or an en dash. This can be verified if you copy paste the string into a tool such as . You'll see the first dash is ASCII 150, while the second is ASCII 45. ASCII 45 is the standard hyphen that is expected.

Fix that, and you should be fine.

4

If you are used to using a Debian/Ubuntu distribution and you change to a CentOS/Red Hat distribution, you may be experiencing problems because the correct user is "apache" on CentOS/Red Hat. The string becomes:

chown -R apache:apache /somefolder

1

what you can also check, is the ID of the user and then run it like

chown -R 999:999 /somefolder

this works almost each time

Posting this here to help other users. My linux version is CentOs6. What worked for me was.

chown -R nobody:nobody /home/driversn/ 
1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy