Skip to main content
Topic solved
This topic has been marked as solved and requires no further attention.
Topic: [SOLVED] Root directory taking the place of the home directory. (Read 910 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

[SOLVED] Root directory taking the place of the home directory.

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?
"If anyone says that systemd is the best init, remember, a shit surrounded by several flies is still shit!"

Re: Root directory taking the place of the home directory.

Reply #1
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 #4
Rename (move) a user account

Precede all commands with sudo
or first run sudo -i


You 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 + F1

First, 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