PDA

View Full Version : chown



Clive Long
21st-January-2007, 02:41 PM
Anyone?

Is there a setting of the "switches" on the chown command that will enable me to change the owner of a directory and ALL sub-directories, and sub-sub-directories by only specifying the base / root /home directory of that particular tree?

Thanks

Clive

boardrider
21st-January-2007, 02:50 PM
Anyone?

Is there a setting of the "switches" on the chown command that will enable me to change the owner of a directory and ALL sub-directories, and sub-sub-directories by only specifying the base / root /home directory of that particular tree?

Thanks

Clive

Do you want to just change the directory ownerships? Or all files underneath as well?

chown -r or -R will do all files and directories.
to do just directories you could try using "find" specifying it find directories and then "-exec chown {} /;" as the final argument or pipe it to xargs.

You could always "man chown". Esp for your distro's particular brand of chown. Not all *nix are created equal.

under par
21st-January-2007, 02:52 PM
Anyone?

Is there a setting of the "switches" on the chown command that will enable me to change the owner of a directory and ALL sub-directories, and sub-sub-directories by only specifying the base / root /home directory of that particular tree?

Thanks

Clive

:confused: :eek: :confused: :blush: ... I thought I was getting the hang of being a bit geeky.... but .. :confused: :confused:

ducasi
21st-January-2007, 04:35 PM
Assuming you want all the files to have changed ownership, you'll want the -R option to chown.

E.g.
chown -R clive ~clive/public_html

Make sure you're not changing the ownership of files you shouldn't be though! ;)