Overview
This topic describes how to mount a bucket to an ECS instance as the www user by using ossfs.
Details
Perform the following steps as the www user to mount a bucket:
Install ossfs and create the
/etc/passwd-ossfs
file. For more information, see Installation.Run the following command to modify the permissions on the configuration file:
chmod 640 passwd-ossfs
Run the following command to obtain the installation path of ossfs:
which ossfs
Run the following command to obtain the UID and GID of the www user.
NoteThis topic uses the www user as an example. If the user does not exist, run the
useradd
command to create the user.id www
Run the following command to modify the owner and owner group of the configuration file:
chown -R www:root passwd-ossfs
Run the following commands in sequence to create a mount directory.
NoteThis topic uses the test1 directory as an example.
su - www mkdir test1
Run the following command to mount a bucket:
/usr/local/bin/ossfs $Bucket test1 -ourl=$URL -ouid=$UID -ogid=$GID -o passwd_file=$File -odefault_permission=750
Note$URL
indicates the endpoint of the bucket.$File
indicates the path of the passwd-ossfs file, such as/etc/passwd-ossfs
.$UID
and$GID
are the UID and GID recorded in Step 4.
Run the following command to confirm that the bucket is mounted:
ls -l test1
Unmount the directory:
Run the following command as the root user to unmount the directory:
umount /test1
Run the following command as a non-root user to unmount the directory:
fusermount -u /test1
References
For more information about ossfs, see Overview.
For more information about FAQ about ossfs, see FAQ.
Applicable scope
OSS