How to change a user’s home directory in Linux?

To change the home directory of a Linux user, you can follow these steps:

  1. Log in to the system using the root account, or log in with a user who has sudo privileges.
  2. Modify the user’s home directory path to /new/home/path.
  3. Change the ownership of the new home directory path to the specified user.
  4. Please restart the system or log out and log back in to apply the changes.

Please be aware that changing a user’s home directory may cause some system settings and applications to not function properly. Therefore, before changing the home directory, make sure to backup all important data and understand the related risks and precautions.

bannerAds