I am reading a book about Linux. It says that one of the ways (although not the best - I am aware that this can also be done with usermod) to change the home directory of a user is to change the home directory in /etc/passwd for that particular user. I have successfully changed the entry for a particular user to


However, upon logging into a shell as this user, I am positioned in /home/mainuser directory and not /home/mainuser/projects. Am I misunderstanding what home directory means? Shouldn't I be in /home/mainuser/projects when I log in?

Additional info:

Running Linux Fedora 25

grep mainuser /etc/passwd mainuser:x:1000:1000:mainuser:/home/mainuser/projects:/bin/bash

$ getent passwd mainuser mainuser:x:1000:1000:mainuser:/home/mainuser/projects:/bin/bash

  • does the "projects" directory exist? if existing check the uid and the gid with the command "ls -l"
    – dubis
    Feb 2, 2017 at 9:19
  • yes, it exists, UID and GID (third and fourth column) is mainuser.
    – sanjihan
    Feb 2, 2017 at 9:25
  • Should work as you describe. Can you post your linux version, the entry of that user in the passwd file, the output of getent passwd mainuser, ls -l /home/mainuser/projects, and the exact comand how you login with that user and its output.
    – chaos
    Feb 2, 2017 at 9:35
  • Ahhh, you need to restart your computer. Just quitting bash isn't enough. Thanks for help.
    – sanjihan
    Feb 2, 2017 at 10:07
  • 4
    You don't need to restart the computer, but you do need to log into a new login shell, which is definitely accomplished by rebooting, but could also be gotten by logging out and in again.
    – mattdm
    Feb 2, 2017 at 14:12


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.