File ownership - changing a whole dir to different owner
I copied files over samba with the setting "map guest to nobody" (or something like that)... So now all files are owned by nobody:nobody
I want to "reclaim" ownership to "username" (my username). I can use the command chown but there's 11000 files... how do I change the user of ALL of them without having to type every file? |
chown -R user:group /path/to/directory/*
or, if you want the directory changed as well, do the same without the trailing /* |
man chown
also works well |
Code:
chown -R Quote:
|
THanks guys, I'll check it out an let you know :)
|
If the directory contains only files, then you don't need to use recursion (-R). Also, if there are to many files in the directory, then you may need to do something like:
sudo find ./ -type f -execdir chown me:me '{}' \; This is because bash will try to expand "*" to a list of all of the arguments, which if the directory has thousands of files, could cause a memory error. |
Thanks
Thanks :) Got it solved
|
All times are GMT -5. The time now is 08:43 AM. |