Moving user to a new 'home'

Trying to get my head around this…
Have a user (eg Ralph), whos User Directory appears to be corrupted (various things: takes a long time to load stuff/stuff doesn’t works as it should, etc), so would like to be able to create a brand new user/home directory, but with the current names.
eg can I just create a new user, login, delete the original user - ralph - without deleting the home directory (but renaming), create new user - ralph - and give him a new Home Directory (called ralph), but with full rights to the original Home Directory?
Hope this is understandable…??

The typical way of doing this is:

  1. Create a new temp_new user
  2. Log in as that new temp_new user, do a bit of testing
  3. Rename ralph to temp_old
  4. Log in as temp_old
  5. Rename temp_new to ralph
  6. Log in as ralph and clean up temp_old
1 Like

The typical way of doing it is

mv /home/ralhp /home/ralph.old
mkdir /home/ralph
chown ralph:ralph /home/ralph

I fail to understand why one would need to create another user.

2 Likes

Just to make sure the profile is totally clean… There are LOTS of unknown files in there.
So, you can move/rename/play with your home directory, while you are logged in as that user?

What “profile”? When you want a new and empty home directory, I would think that

mkdir /home/ralph

as sugested by @arvidjaar does just that. New directory, nothing in it.

No you can’t. The procedure of @arvidjaar works fine if you boot as another user or of you for example boot from an USB live image. For the 6 step procedure I did give that is not needed but it is more convoluted.

One does NOT boot “as a user”.

And for doing these system management tasks (doing things in /home) one needs to be superuser root.

Of course doing it from a rescue system is also possible, but a bit overdone.

On system level (e.g. file ownership) it is not the user name (“ralph” or “temp_new”) but the UID that defines the user.

User “temp_new” will have a different UID than “ralph” and this will not change automatically when you rename “temp_new” to “ralph”.