How to change file ownership when chown says "invalid user: ‘–R'"?
38,536
You must have copied the command from a webpage that uses strange formatting. That's not a normal minus, try this instead:
sudo chown -R hduser:hadoop mongodbdata
Specifically, the one I copied from your question is an en dash (U+2013):
$ unicode -s –
U+2013 EN DASH
UTF-8: e2 80 93 UTF-16BE: 2013 Decimal: –
–
Category: Pd (Punctuation, Dash)
Bidi: ON (Other Neutrals)
Related videos on Youtube
![Christopher Gaspar](https://lh5.googleusercontent.com/-BtuZaC-mMHo/AAAAAAAAAAI/AAAAAAAAABU/rsjEndfWMiw/photo.jpg?sz=256)
Author by
Christopher Gaspar
Updated on September 18, 2022Comments
-
Christopher Gaspar almost 2 years
ubuntu64@ubuntu:/$ sudo chown –R hduser:hadoop mongodbdata chown: invalid user: ‘–R'
When I try to change the ownership of the file, I am just getting
invalid user: '-R'
error. -
shadowwalkers about 9 yearsIn this context, it's probably more appropriate to call it a hyphen than a minus.
-
terdon about 9 years@Alex I beg to differ. Personally, I prefer minus in this context and hyphen when talking about text. I am not alone, that is the standard old school UNIX way. Some people do say dash but I've never heard it called a hyphen in this context.
-
shadowwalkers about 9 years@terdon Huh. That seems really odd to me, but tradition does count for something. I've only ever used the word minus in math.
-
terdon about 9 years@Alex both minus and dash are used in this context but certainly not hyphen which is a different thing altogether.