0

I know how to find all the files & folders owned by a specific user, say tommy:

find / -user tommy

But how can I chown the files & folders to another user, say peter?

I know I can change specific files & folder via this command:

sudo chown -R peter /the/specific/folder

1 Answer 1

1

You can use something like this:

find / -user tommy -exec chown peter {} \;
3
  • Is it recursive? do I need the -R flag?
    – Raptor
    Jan 20, 2022 at 8:52
  • 1
    -R won't be needed as this find -exec command runs chown on every found file or directory
    – vautee
    Jan 20, 2022 at 9:05
  • thanks for your help.
    – Raptor
    Jan 20, 2022 at 9:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .