[CENTOS] Mounting Aliyun OSS to VPS server using ossfs

[CENTOS] Mounting Aliyun OSS to VPS Server using ossfs


  1. Prepare a Bucket for mounting and configure the permissions.

  2. Obtain the access key and secret key that can be used for mounting the Bucket.

  3. Download and install the ossfs package.


  1. Install locally.

sudo yum localinstall ossfs_1.80.6_centos7.0_x86_64.rpm

  1. Configure access by storing the Bucket name, AccessKeyId, and AccessKeySecret with access permissions for this Bucket in the /etc/passwd-ossfs file. Make sure to set the correct permissions for this file, it is recommended to set it as 640.

echo my-bucket:my-access-key-id > /etc/passwd-ossfs
chmod 640 /etc/passwd-ossfs

  1. Mount the Bucket to the specified directory.


ossfs my-bucket my-mount-point -ourl=my-oss-endpoint

777 permission mode, can be used by non-root users#

ossfs my-bucket my-mount-point -ourl=my-oss-endpoint -o allow_other

  1. Unmount the mounted Bucket.

fusermount -u my-mount-point

Some considerations:

  1. If you want to support writing and control file permissions, the user must have full control permissions for the Bucket, otherwise the permission configuration will be lost after the next mount.
  2. If used as a remote hard drive and allowing non-root users and other users to read and write, you need to add -o allow_other.
  3. Uploading large files will result in fragmented storage in the OSS Bucket, so it is recommended to minimize the transfer of large files as there will still be latency even with a fast internal network.
  4. Streaming or low-level disk read/write operations can freeze the OSS, such as the dd command, as it is not a real hard drive.
  5. ossfs scans the contents of files in OSS, so if there are many files, it is best to avoid operations like ls and find.
  6. It is not recommended to use the fstab method for startup, as it may prevent your VPS from restarting.


Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.