chown: invalid option -- 'd'

I'm following this guide to setting up Lamp.

I'm on section 4 - Assign ownership of public_html directory to the user $www-data:

I'm copying and pasting the command and changing it so it has my site folder in it - like this:

sudo chown -R $www-data:$www-data /var/www/html/

Everytime I get this error:

chown: invalid option -- 'd'
Try 'chown --help' for more information.

Can anybody tell me what's going on please. I can't even see an option "d" in the command.

5 Replies

I got round it by removing the $ from the command. Will that have broken something?

@nnn07 - No, that shouldn't have broken anything! The $ symbol typically indicates a variable, so the command may have been taking the -d in www-data and parsing it incorrectly. I've reached out to our Docs team for more information regarding why the command was phrased that way in our guide as well.

Ok thanks.

That cost me well over an hour last night :-)

I have the same issue. I'm following the instructions here:

Ubuntu 20.04 LTS, I'm setting up new WP server.

Based on my experience, the dollar signs shouldn't be there.

Same issue. The docs still contain $.


Please enter an answer

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct