挂载对象存储(S3/OBS/OSS)到Linux本地的方法

错误:s3fs: credentials file /etc/passwd-s3fs should not have others permissions.

安装s3fs

apt update
apt install s3fs

echo <access-id>:<access-key> >/etc/passwd-s3fs

之后一定需要将对应的凭证修改权限,否则会报错:“s3fs: credentials file /etc/passwd-s3fs should not have others permissions.”

修改权限:
chmod 600 /etc/passwd-s3fs
挂载
s3fs OSS-test /tmp/s3 -o passwd_file=/etc/passwd-s3fs -o url=http://192.168.137.3:9000 -o use_path_request_style -o allow_other

经过测试,挂载至本地之后的s3fs目录,还可以进一步的映射到docker容器的内部进行读写。