Usually the home directory name is the same as the system user, however in my case, and I have no idea how, but the home folder got renamed with an extra letter… I may have inadvertently done it but I cannot recall.
Question is how can I rename it back to the system admin user name like it should be, and keep all the existing data?
Looking at the manpage for usermod, this should do it: sudo usermod --move-home --home /path/to/new/name
–home sets the home directory in /etc/passwd and --move-home creates the new directory and moves the contents of the previous home directory there. The new directory must NOT exist.
Thanks, but when I try that all I get is a list of options
Usage: usermod [options] LOGIN
Options:
-a, --append append the user to the supplemental GROUPS
mentioned by the -G option without removing
the user from other groups
-b, --badname allow bad names
-c, --comment COMMENT new value of the GECOS field
-d, --home HOME_DIR new home directory for the user account
-e, --expiredate EXPIRE_DATE set account expiration date to EXPIRE_DATE
-f, --inactive INACTIVE set password inactive after expiration
to INACTIVE
-g, --gid GROUP force use GROUP as new primary group
-G, --groups GROUPS new list of supplementary GROUPS
-h, --help display this help message and exit
-l, --login NEW_LOGIN new value of the login name
-L, --lock lock the user account
-m, --move-home move contents of the home directory to the
new location (use only with -d)
-o, --non-unique allow using duplicate (non-unique) UID
-p, --password PASSWORD use encrypted password for the new password
-P, --prefix PREFIX_DIR prefix directory where are located the /etc/* files
-r, --remove remove the user from only the supplemental GROUPS
mentioned by the -G option without removing
the user from other groups
-R, --root CHROOT_DIR directory to chroot into
-s, --shell SHELL new login shell for the user account
-u, --uid UID new UID for the user account
-U, --unlock unlock the user account
-v, --add-subuids FIRST-LAST add range of subordinate uids
-V, --del-subuids FIRST-LAST remove range of subordinate uids
-w, --add-subgids FIRST-LAST add range of subordinate gids
-W, --del-subgids FIRST-LAST remove range of subordinate gids
usermod will try to adapt the ownership of the files and to copy the modes, ACL and extended attributes, but manual changes might be needed afterwards.
This may cause issues if anything has hardcoded the user’s directory.
Probably best to do this from another user, such as root, so replace $USER with the username.
yeah sorry, root - the only time I entered the correct name for this ws at the installationm stage where the installer auto created the user name which was simply the same name but in lower case. As far as I know I have NOT modified any name since then, so how the home folder got it’s name changed with an added letter is a mystery. I am thinking I might just have to accept it and either move on or fully reinstall Linux…which would be a pita as I have spent a lot of time “tweaking” it out to suit!
sorry, not trying to be obtuse, just trying to understand.
sorry again, no the new home needs to be denzoid , it is already denzooid and when I try that (change the last entry to denzoid) I get new home does not exist
Mod edit:- Please avoid consecutive posts. Remedied. No charge.
I repeat you should leave this until you understand the system better. As this should probably be run from a root shell, and you don’t understand what root is yet.
Make a backup of the /home/denzooid_NEW_HOME
It may be needed to rename it first. And it is very recommended to do this logined as root and NOT as denzooid.
sorry they are the same names in both…ok again, it is ALREADY denzooid - this is wrong- it needs to be changed to denzoid
ok fair, however the user name I entered at install was Denzoid…hmmmmm mebbe I did a typo then and added the extra o??
Which still leaves the question of changing it to the single o - maybe I should give up and just do a complete re-installation and just accept another three hours wasted setting it all up again.