User need to make sure that is NOT logged in as the user whose name you are about to change. Possibly reboot and then login as root.
:::Following are commands that i have tried and which broken numerous things, so i suggest not to try, it, just for information: ::
sudo killall -u OLD
id OLD # not needed? just shows IDs
usermod -l NEW -m -d /home/NEW OLD
shows still some process? i have killed it by "kill -9 number" and then repeat previous command
groupmod -n NEW OLD
usermod -c "New Real Name" NEW
sed -i "s|OLD|NEW|g" /etc/lightdm/lightdm.conf
I do not suggest running following 2 find commands as it may break various things, backup is a MUST:
A) VERY SLOW COMMAND TO EXAMINE ALL FILES AND REPLACE OLD USERPATH BY NEWUSER PATH (ideas to improve it?):
find /home/NEW /etc /usr -type f -exec sed -i -e 's/\/OLD\//\/NEW\//g' {} +
Or B) MAY BE FASTER?:
time find /home/NEW/ /etc /usr -type f -exec grep -I -q . {} \; -print0|xargs -0 sed -i 's|/OLD/|/NEW/|g'
They mention bunch of other possible things that may need to be tweaked.
I was trying to search some bash script that handles everything needed, but not found.
The list of commands i have mentioned is safe to try and should not break the OS/XFCE? Or do you suggest any other or know about the tutorial or script? Thanks
— sidenotes —
change autologin-user in /etc/lightdm/lightdm.conf
example command to replace old user home path by new one in home: cd /home/newuser && find ./ -type f -readable -writable -exec sed -i "s/\/home\/olduser/\/home\/newuser/g" {} \;
actually there is at least 962 files outside of /home that possibly needs changing ownership: find /etc /usr /var /tmp -user OLDUSER -print0 2>/dev/null|xargs -0 chown -h NEWUSER
dead links?
A) find /home/newuser -xtype l
B) find /home/hp -xtype l -exec stat {} ;
if SSH fails to work: sudo chmod g-w /home/$NEWLOGIN
I have tried the steps described in the first post of this topic, yet it failed, the default file manager Dolphin was not working (core dumps, while under root worked), somehow possibly all e-mail in Thunderbird was duplicated and when clicked e-mail it shown source code instead of normal text. Some file links was dead + likely many other tiny issues. So i have decided to do the process again going from new to old username. After that, my firefox profile was broken(it was likely broken after first/initial username changing process), Thunderbird duplicate e-mails, had to restore both from external backup ~/.mozilla, and ~/.thunderbird
Some journalctl issues here after all this is finished
So in my opinion there is no good tutorial on how to change username.
Without any tutorial i can also try to create new user, migrate data (question is how) + various .config, .cache etc. files will still contain old usernames which MAY be problematic, or i will skip many such files which will need me to reconfigure various things. So again there i am not aware about tutorial which would describe what to copy, which commands to run.
→ changing username is not possible - not documented for noob user (unless i have missed some tutorial)