chown: invalid user: ‘www–data:www-data’

3

1

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

Orlo

Posted 2014-01-13T22:27:22.197

Reputation: 241

Check if this and this will help.

– VL-80 – 2014-01-13T22:33:39.133

1What happens if you try to issue command without group? chown -R www–data /somefolder – VL-80 – 2014-01-13T22:42:37.903

does the user exist in /etc/shadow as well? – ernie – 2014-01-13T23:20:19.680

Weird, should work. What happens if you use chown www-data.www-data /somefolder ? (ie . rather then :) – davidgo – 2014-01-14T02:12:20.030

@Nikolay chown: invalid user: ‘www–data’ – Orlo – 2014-01-14T08:02:33.977

@ernie yes, it's there as well. – Orlo – 2014-01-14T08:03:40.607

I see. Very interesting... What if you try to use UID instead of username? chown -R 33:33 /somefolder ? – VL-80 – 2014-01-14T13:24:23.700

Answers

6

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 http://www.asciivalue.com/. 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.

ernie

Posted 2014-01-13T22:27:22.197

Reputation: 5 938

1Keep getting chown: invalid user: ‘www-data:www-data’ still – cyber8200 – 2016-01-22T16:03:17.633

This is what I was going to point out. try using - instead of the and it might fix your problem altogether – PsychoData – 2014-01-14T16:58:30.310

+1. Brilliant. Difference can be seen even visually. You are very observant. – VL-80 – 2014-01-14T17:51:36.990

0

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

matson kepson

Posted 2014-01-13T22:27:22.197

Reputation: 101

0

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

Adrien

Posted 2014-01-13T22:27:22.197

Reputation: 1