If you are the root user, you can use the “umount /attached directory” command to detach a directory.
If you are a non-root user, you can use the following command to detach a directory:
fusermount -u your_mountpoint
Prerequisites: directory to attach: test1; account name: www (no logon permission); bucket to attach: dcces
“Which ossfs” is used to obtain the OSSFS installation path, because a regular account does not have the required permission.
1. Log on using the root account.
2. Run the “id www” command to obtain the UID and GID.
3. Create the directory to which you want to attach a bucket through the root account or other account, and run the following command to change the directory owner: chown -R www:root test1
4. Run the following command to modify the permission on the configuration file: chmod 600 passwd-ossfs
Run the following command to change the owner of the configuration file and the group where it belongs:
chown -R www:root passwd-ossfs
5. sudo -u www /usr/local/bin/ossfs dcces test1 -ourl=https://oss-cn-hangzhou.aliyuncs.com -oallow_other -omp_umask=007 -ouid=504 -ogid=0 -o passwd_file=ttpasswd-ossfs -odefault_permission=750
6. Run the following command to attach the bucket to the directory:
sudo -u www ls -ll test1