Rename home directory and keep all the data?

comes up with the double o - denzooid this is what I wish to change to denzoid

So it was a typo during install, it’s not just the user’s home dir, it’s also the username.

The easiest option is to leave it as it is. I suggest you seriously consider doing so, unless it bothers you so much that you’re willing to reinstall.

:warning:

Try this at your own risk

You can try changing both, it that breaks something then you can try changing it back or reinstalling.

:warning: I haven’t tested this, and even if it works as intended it’s possible it will still break things. :warning:

:warning: If you break things and can’t revert then you’ll need to reinstall. :warning:

Step by step guide

  1. Log out of your user
  2. Press Ctrl + Alt + F3
  3. Login as root, the username should be root and the password is the root password you set up during install. It may or may not be the same as your user’s password.
  4. Run usermod -l denzoid denzooid
  5. Run usermod --move-home --home /home/denzoid denzoid
  6. Run groupmod -n denzoid denzooid
  7. Press Ctrl + Alt + F1 to get back to a GUI login, if that doesn’t work try Ctrl + Alt + F2 etc
  8. Try to login as your user.

If you can’t login, a restart may or may not help.

To change it back:

  1. Press Ctrl + Alt + F3
  2. Login as root, the username should be root and the password is the root password you set up during install. It may or may not be the same as your user’s password.
  3. Run usermod -l denzooid denzoid
  4. Run usermod --move-home --home /home/denzooid denzooid
  5. Run groupmod -n denzooid denzoid
  6. Press Ctrl + Alt + F1 to get back to a GUI login, if that doesn’t work try Ctrl + Alt + F2 etc
  7. Try to login as your user.

:warning:

2 Likes

This is merely a folder name. Please consider to keep it. It’s probably not worth the effort - especially so if you make another typo when being the root user. It’s like
:bomb: :man_with_white_cane:

1 Like

Don’t follow this guide, it could break your system, wrong command syntax and wrong to do this as root. :face_with_medical_mask:

See warning when applying $ man usermod

WARNING
     You  must  make  certain that the named user is not executing any processes when this command is being executed if
     the user's numerical user ID, the user's name, or the user's home directory is being changed. usermod checks  this
     on Linux. On other operating systems it only uses utmp to check if the user is logged in.
2 Likes

I haven’t done it in well over a decade so I may well be wrong.

How so?

I see nothing that implies you shouldn’t do it as root. You need root privs anyway.


I just checked with a test user and both usermod commands seem to work. However I did forget about the group, which should also be renamed.

That is very likely.

  1. Log out of your graphical session, completely. You have to be looking at the login screen.

  2. Press CtrlAltF3 to switch to tty3.

  3. Log in as rootnot as yourself!

  4. Issue the following commands… :backhand_index_pointing_down:

    mv /home/denzooid /home/denzoid
    for f in /etc/passwd /etc/shadow /etc/group /etc/gshadow /etc/sudoers /etc/sudoers.d/* ; do sed -i 's/denzooid/denzoid/g' $f ; done
    sync
    

Now, for good measure, reboot. While in a tty, you can use the three-finger salute to reboot safely, i.e.CtrlAltDel.

When the system comes back up, log in as denzoid.

1 Like

@pax-eterna consider how important is this installation for you. Make a backup. The procedure is not without caveats. There are many things to consider. Honestly, if i was a beginner user i would leave it be, if not ready to reinstall.
A long discussion is currently running among the most experienced forum brains “which is the right way to do this”. This has to tell you something about the potential risks.

2 Likes

Exactly what Teo said!
If that messes things up, you always have the option of a reinstall later if you like.
Just make sure that you first back up anything you really want to keep from that old directory first so you can restore it later as needed.

1 Like