33

Here is a short description of what I want to do:

User tom has id 1000. I'm calling usermod -u 2000 tom.

What happens exactly besides that the id of tom changes to 2000? Do files and folders which were owned by this user still remain by this user or do I have to explicitly set the owner again?

Thanks for your help!

0

1 Answer 1

29

usermod will change permissions for the user's files inside his home directory. files outside his home directory will have to be changed manually.

man usermod lists the following caveats:

You must make certain that the named user is not executing any processes when this command is being executed if the user's numerical user ID, the user's name, or the user's home directory is being changed. usermod checks this on Linux, but only check if the user is logged in according to utmp on other architectures.

You must change the owner of any crontab files or at jobs manually.

You must make any changes involving NIS on the NIS server.

3
  • is there any easy method to go through all files (not only home directory), check if they have the old uid and change it to the new one?
    – mryvlin
    Commented Aug 15, 2013 at 7:40
  • 8
    Is find / -uid 1000 -exec chown -R tom {} \; sufficient or do I have to do more?
    – mryvlin
    Commented Aug 15, 2013 at 7:46
  • 17
    You probably want to remove the -R in the find, as this makes the chown recursive. It is common to have files owned by a different user then the directory containing those files.
    – Dennis
    Commented Dec 9, 2013 at 18:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.