Creating a Readable and Writable Subdirectory on the File System for Each User
Prerequisites
- A file system has been created and can be mounted to the ECS by the root user. For details, see Creating a Local Directory for a File System.
- You have obtained the mount point of the file system.
Procedure
- Log in to the ECS as user root.
- Run the following commands to add a common user under the root account. User Tom is added as an example.
adduser Tom passwd Tom
Change the password of common user Tom as prompted. After the user is created, the home directory /home/Tom is automatically created.
- Run the following command in the local directory of the root user to create a subdirectory.
According to 4 in Creating a Local Directory for a File System, the local directory of the root user is root001. Run the following command to create subdirectory Tom for common user Tom. Replace root001 with the actual local directory.
mkdir /root/root001/Tom
- Run the following command to assign the read and write permissions of subdirectory Tom to common user Tom. Replace root001 with the actual local directory.
chown Tom:Tom /root/root001/Tom
After the subdirectory is created, run the following commands to check whether common user Tom has the read and write permissions on subdirectory Tom. See Figure 1.
cd /home cd /root/root001 ll
The preceding command output indicates that user Tom has obtained the read and write permissions on subdirectory Tom.
- Run the mount command to mount subdirectory root001/Tom to the home directory of Tom, /home/Tom. In the following command, xx-xxxxx-xx needs to be replaced with the region where the file system is located, and share-xxxx needs to be replaced with the actual file system. The first Tom needs to be replaced with the actual subdirectory name. See Figure 2.
mount -t nfs sfs-nas1.xx-xxxxx-xx.xxxxxxxxxx.com:/share-xxxx/Tom /home/Tom
Run the following command to check whether the subdirectory has been mounted to the home directory of Tom. See Figure 3.
df -h
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot