Change superuser's username


#1

Is it possible to change the username of the (only) superuser of the system and not damaging anything??
(With root privileges obviously)
If yes please let me know how…

Thank you!!


#2

It is all here https://wiki.archlinux.org/index.php/Users_and_groups#Change_a_user.27s_login_name_or_home_directory
But I fear that you somehow would make a mistake.

Better use Manjaro Settings Manager to add an new user with (sudo rights), then log in with the new user and copy relevant settings from the old user folder, then delete the old user with Manjaro Settings Manager.


#3

I’ll try it on a VM first using the Arch wiki guide and if I fail I will do it your way…

Thank you very much!!


#4

Warning: Make certain that you are not logged in as the user whose name you are about to change. Open a new tty (Ctrl+Alt+F1) and log in as root or as another user and su to root. usermod should prevent you from doing this by mistake.

Danger, Will Robinson! :smiley:

Take care!


#5

as you try in vm, I think it would safe.
login as olduser/(user that you wish to change), find uid and gid using “id” command,
example output :
uid=1000(olduser) gid=100(users) groups=100(users),3(sys),7(lp),10(wheel),90(network),91(video),93(optical),95(storage),96(scanner),98(power)

then logout and login as root,

  • mv /home/olduser /home/olduserbackup
  • userdel -r olduser
  • useradd -u 1000 -g 100 -G sys,lp,wheel,network,video,optical,storage,scanner,power newuser
  • passwd newuser
    (twice type your new user password)
  • rsync -aAHXxv /home/olduserbackup/ /home/newuser (<-- without “/” in the end)

or just:

  • mv /home/olduserbackup /home/newuser

reboot and login as newuser
replace “olduser” with your username and “newuser” with your desire name


#6

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.