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 74 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.
4If 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
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