LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Desktop (https://www.linuxquestions.org/questions/linux-desktop-74/)
-   -   File ownership - changing a whole dir to different owner (https://www.linuxquestions.org/questions/linux-desktop-74/file-ownership-changing-a-whole-dir-to-different-owner-475404/)

sKAApGIF 08-19-2006 12:16 PM

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?

bernied 08-19-2006 01:01 PM

chown -R user:group /path/to/directory/*
or, if you want the directory changed as well, do the same without the trailing /*

bernied 08-19-2006 01:02 PM

man chown
also works well

boilertech 08-19-2006 08:56 PM

Code:

chown -R
is the command to use
Quote:

-R, --recursive operate on files and directories recursively

sKAApGIF 08-20-2006 05:42 AM

THanks guys, I'll check it out an let you know :)

jschiwal 08-20-2006 05:48 AM

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.

sKAApGIF 08-21-2006 08:25 AM

Thanks
 
Thanks :) Got it solved


All times are GMT -5. The time now is 08:43 AM.