chown recursive?

jove

Member
Hello,

I would like to change the owner of an entire directory structure, including the files.

chown -R otheruser ~origuser/Documents/

only changes the directories in the structure, not the files. How do I include them in the command?
 

jimr

McInstigator
however ... both ways work for me.....

???????????????????????????????????????????????????
your demo syntax is a bit strange
chown -R otheruser ~origuser/Documents/

who is other user whois origuser who are you logged in as?

[short answer] do you have permissions to do that?

[long answer] don't do that.

let's say... ~ = $HOME
which it does

so if your user name is joe

then ~/Documents =
/Users/joe/Documents

ls -al ~

gives

drwx------ 97 joe wheel 3254 Oct 28 23:02 Documents/


as one of the entries


so you want to give the permission to
sam to read that directory

better to add sam and joe to a group which can read that directory in Netinfo

chown -R :mygroup ~/Directory
chmod 770 ~/Directory


anyway the -R certainly works if you have the permission if not you will have to use sudo.

anyway, changing group ownership and readability is much better than changing the owner.
 

jojo

Registered
yes ....
and if you want you can do it after su root and take off "/" at end
 

Jadey

sosumi
Just a reply to "try without the backslash". This: / is a slash, not a backslash. This: \ is a backslash.
 

jimr

McInstigator
Originally posted by Jadey
Just a reply to "try without the backslash". This: / is a slash, not a backslash. This: \ is a backslash.
some nightmare from windows must've attacked my brain...

on top of that around here \ looks like ¥ (yen mark) So that is why the japanesr business people thinks using windows will bring them money...
 
Top