Find the answer to your Linux question:
Results 1 to 3 of 3
I have a few thousand files spread through out a number of directories that need the owner and group changed. The problem is, it is not all files that need ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jan 2005
    Posts
    29

    Change Owner on many files how to?


    I have a few thousand files spread through out a number of directories that need the owner and group changed. The problem is, it is not all files that need these changes. I copied the files from a susie to a fedora install and the user ids / group ids changed.

    So what I need to do is find all files with uid 30 and change it to a user. Then I need to do the same based on gid. I tried the find command based on UID and it did not work correcly. The files that need to be changed do not show a user but a number because the users do not exist.

    I tried
    find -nouser -exec ls -l {} \;

    But that returned everything with either group or owner without owner. That will not work. I need to find specific by group or user.

    I tried also

    find / -uid 30
    But this returned everything.

    Any thoughts?

  2. #2
    Linux User DThor's Avatar
    Join Date
    Jan 2006
    Location
    Ca..na...daaa....
    Posts
    319
    Hmm, I can't explain why your find example didn't work.

    find / -uid 30

    works here just fine. Try testing on a smaller, more local area with some examples that match so you can debug this more.

    [EDIT]Oh duh, I'm an idiot. Make a dummy user with that userid first. find is probably getting messed up because you're asking for a "nonexistant" thing as far as it's concerned.

    DT

  3. #3
    Linux Guru bigtomrodney's Avatar
    Join Date
    Nov 2004
    Location
    Ireland
    Posts
    6,133
    Unfortunately I'm finding the same. If I search for my own UID with that command it easily locates my files, filtered from the others. Even running that command with UIDs that don't exist 'successfully' finds nothing.

  4. $spacer_open
    $spacer_close

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •