Dear All,
I'd be grateful for some guidance on this. As a Linux novice, I set up my system and used it with gay abandon as root (I know, I know...), gathering all sorts of useful data on the disk.
Now I know better (!), I have different user accounts, but the problem is that I have entire directories with subdirectories under them and files in all those, all of which belong to root/root. WHen I want to move them as an ordinary user, of course I'm denied access.
My question is: is there a command that I can issue (as root, presumably) that will go through an entire directory (including all the subs and files in each), changing the ownership of everything to what I specify (e.g., root/users or gerald/users, perhaps)?
Any clues most welcome!
Gerald.
Edenyard wrote:
Dear All,
I'd be grateful for some guidance on this. As a Linux novice, I set up my system and used it with gay abandon as root (I know, I know...), gathering all sorts of useful data on the disk.
Now I know better (!), I have different user accounts, but the problem is that I have entire directories with subdirectories under them and files in all those, all of which belong to root/root. WHen I want to move them as an ordinary user, of course I'm denied access.
My question is: is there a command that I can issue (as root, presumably) that will go through an entire directory (including all the subs and files in each), changing the ownership of everything to what I specify (e.g., root/users or gerald/users, perhaps)?
Any clues most welcome!
chown -R user:group /<directory>
so:
chown -R gerald:users /home/mystuff
My question is: is there a command that I can issue (as root, presumably) that will go through an entire directory (including all the subs and files in each), changing the ownership of everything to what I specify (e.g., root/users or gerald/users, perhaps)?
find /wherever -print0 | xargs -0 chown gerald.users
wbh W.B.Hill@uea.ac.uk writes:
find /wherever -print0 | xargs -0 chown gerald.users
'chown -R' is a trifle more idiomatic, though a variant using find would be appropriate if you wanted to chown more complicatedly chosen set of files.