Site icon New Generation Enterprise Linux

Stop getting burned by UID/GID collisions when moving home dirs

User & Group Management

Stop getting burned by UID/GID collisions when moving home dirs

🧩 The Challenge

Migrating home directories between servers is a nightmare when the UID on the source machine doesn’t match the destination. I’ve spent way too much time fixing weird permission errors because user ā€˜bob’ was 1001 on the old box and 1005 on the new one.

šŸ’” The Fix

Use find to mass-chown files based on the old UID so you don’t have to manually hunt down every stray config file. This saves you from those midnight panics when an application suddenly can’t read its own data.

find /home/bob -uid 1001 -exec chown 1005:1005 {} +

āš™ļø Why It Works

By targeting the specific numeric UID, you bypass the need for a local username match and force the files to align with the new user’s ownership immediately. It’s cleaner than running chown recursively and hoping you didn’t accidentally change system files.

šŸš€ Pro-Tip: Always double check with -ls before pulling the trigger on the chown command so you don’t accidentally update files you didn’t mean to.

Linux Tips & Tricks | Ā© ngelinux.com | 8/6/2026

0 0 votes
Article Rating
Exit mobile version