I have a 10+ TB NFS /home for 100+ users plus public folders. I need to change the username and UID of 10 of those users. At first, I was thinking of running the following:
find /home -uid 812 -exec chown NEWUSER {} \;
Now, the issue on this is that it will go through all my 10TB once and change whatever file it finds with uid 812 to NEWUSER, which is what I want. But it will take a pretty long time, and will do it just for that user; then I will have to run the command again for each of the other 9 users, turning it from a pretty long time to a pretty long time * 9.
Besides the fact that I don't like scripting, I guess a script would be a friend here, but I don't know where to start. I want to use the find
command and check all the files from /home. then:
IF FILEOWNER IS 813 then NEWOWNER IS NEWUSER1
IF FILEOWNER IS 814 then NEWOWNER IS NEWUSER2
... and so on.
Do you think there is a way to do this so I don't have to scan 10 GB of data 10 times -- to just scan once?
-h
option. Otherwise the targets of symlinks will be changed. – Mark Plotnick Jul 15 '17 at 02:17