[SOLVED] Root directory taking the place of the home directory. 04 December 2021, 22:24:20 My "~" and "$HOME" variables go to the root directory, not to the home directory. What is the solution when I type "cd (~ or $HOME)" to direct to my "/home/{user}" directory? Last Edit: 17 December 2021, 21:58:04 by nous
Re: Root directory taking the place of the home directory. Reply #1 – 05 December 2021, 00:00:52 When logging in, do you get a message with the contents:Code: [Select]No directory, logging in with HOME=/?
Re: Root directory taking the place of the home directory. Reply #2 – 05 December 2021, 21:06:53 Code: [Select]% grep $USER /etc/passwd 1 Likes
Re: Root directory taking the place of the home directory. Reply #3 – 05 December 2021, 21:14:38 @OP,Code: [Select]man usermod(-d option).
Re: Root directory taking the place of the home directory. Reply #4 – 06 December 2021, 07:13:03 Rename (move) a user accountPrecede all commands with sudoor first run sudo -iYou cannot rename a user account when it is in use!It is therefore imperative to "disconnect" and work from another account or in console mode Ctrl + Alt + F1First, do some tests on a new "test" account, which will be renamed to "test1", "test2" etc ... before getting down to business. First, it is safe to copy the user's home directory:Code: [Select]cp -a -R /home/dupont /home/dupont_save (copies the user's directory and names it in dupont_save and keeps the rights).When there is not enough space on the hard drive, copy the personal directory to another medium (external drive for example).Then in a root or sudo -i terminal:Code: [Select]mv /home/old_user /home/new_user (renames the user's directory).Code: [Select]usermod -l user_new old_user (rename user).Code: [Select]usermod -d /home/new_user -m new_user (-d indicates the path to the user's new home folder and -m modifies (adapts) the rights).Code: [Select]groupmod -n user_new old_user (renames the user's primary group).Code: [Select]chfn new_user allows you to modify the full name of the user as well as other optional information.Code: [Select]passwd new_user and give the new password.My little "french cooking recipes" from 2014:https://willms.pagesperso-orange.fr/linux/renommer_utilisateur.html Last Edit: 07 December 2021, 04:33:23 by tintin
Re: Root directory taking the place of the home directory. Reply #5 – 16 December 2021, 21:21:29 Quote from: nous – on 05 December 2021, 21:06:53Code: [Select]% grep $USER /etc/passwdThanks for the answer, it's already resolved!