Migrate Linux from X to Y.
First of all, login with root
, then using usermod
to change username:
usermod -l newUserName -d /home/newUserName -m oldUserName
Linux use uid to identify user, so changing username will not affect permissions.
Then, find all broken symlinks and fix it:
find . -xtype l
Last but not least, Search all configurations and change username, I recommand ripgrep.
rg oldUserName