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-ossfsfile. For more information, see Installation.Run the following command to modify the permissions on the configuration file:
chmod 640 passwd-ossfsRun the following command to obtain the installation path of ossfs:
which ossfsRun 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
useraddcommand to create the user.id wwwRun the following command to modify the owner and owner group of the configuration file:
chown -R www:root passwd-ossfsRun the following commands in sequence to create a mount directory.
NoteThis topic uses the test1 directory as an example.
su - www mkdir test1Run 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=750Note$URLindicates the endpoint of the bucket.$Fileindicates the path of the passwd-ossfs file, such as/etc/passwd-ossfs.$UIDand$GIDare the UID and GID recorded in Step 4.
Run the following command to confirm that the bucket is mounted:
ls -l test1Unmount the directory:
Run the following command as the root user to unmount the directory:
umount /test1Run 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