How to change default home directory?

To change the default home directory of a user in Linux, you can use the usermod command. Here’s how to do it:

  1. Open a terminal.

  2. Run the following command, replacing new_home_directory with the desired path and username with the name of the user:

    sudo usermod -d /path/to/new_home_directory username

    For example, to change the home directory of a user named joker to /home/wayne, you would run:

    sudo usermod -d /home/wayne joker
  3. To verify the change, you can check the /etc/passwd file with:

    sudo grep -w 'username' /etc/passwd

This will show you the updated home directory for the specified user.

0 Comments

no data
Be the first to share your comment!