How to create a user on Ubuntu and save it to a different disk?

To create the home directory of new users on another disk, you can follow these steps:

  1. information
sudo mkdir /data/userhome
  1. create a new user
  2. – newcomer
sudo useradd -d /data/userhome/newuser newuser
  1. Next, the permission settings for the home directory of the new user should be set to the owner and group of the new user.
sudo chown newuser:newuser /data/userhome/newuser
  1. Finally, establish a password for the new user.
sudo passwd newuser

You have successfully created the home directory for the new user on a different drive. The user can now log in using the new username and password, and their home directory will be located in the /data/userhome/newuser directory.

bannerAds