Undo sudo chown -R <user>:www-data * for home directory

February 15, 2016 1.2k views
Linux Commands Security Linux Basics Ubuntu

I accidentally granted www-data ownership permissions for my home directory using sudo chown -R demo:www-data *. How would one go about undoing this?

Thank you.

1 Answer

If you're logged in as root,

chown -R username.groupname ~username

where groupname is usually the same as username. If instead you are using a non-root login with superuser privileges, then just prepend that command with "sudo".

Have another answer? Share your knowledge.