How to change home directory location?

To change the home directory location of a user in Linux, you can use the usermod command. Here’s the syntax:

sudo usermod -d /new/home/directory username

Replace /new/home/directory with the desired path for the new home directory and username with the actual username of the user whose home directory you want to change.

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

sudo usermod -d /home/wayne joker

After changing the home directory, you can verify the change with:

sudo grep -w 'joker' /etc/passwd

This will show the updated home directory for the user.

0 Comments

no data
Be the first to share your comment!