Related to this question, I recently detached a disk from a Linux cloud machine (Ubuntu 18.04). When I reattached it to a new VM (also Ubuntu 18.04) I discovered that the user and group information had been lost, and most of the files were now owned by '1003:1003'.
My goal is to give my username (which is the same on both machines) access to the files but I would like to avoid using chown
to change the ownership on thousands of files, some of which have other owners and perhaps should not be changed. So I have two questions:
- Is there a way to easily reclaim the old group information that associates 1003 with my username and group?
- Let's say I do have to use
chown
: how do I change the ownership of only the files that are owned by '1003'?
Thanks
/etc/group
and/etc/passwd
are editable by root and fairly self-explanatory. You will probably be able to recover your names there using the1003
id. – Stephen Boston Jul 17 '20 at 03:50