Github下载:https://github.com/aliyun/ossfs/wiki
git
# https://github.com/aliyun/ossfs/releases/download/v1.80.5/ossfs_1.80.5_centos7.0_x86_64.rpm # yum localinstall ossfs_1.80.5_centos7.0_x86_64.rpm
Root帐户卸载:umount /挂载目录
非root用户要卸载目录,请用:fusermount -u your_mountpointgithub
前提:挂载目录test1,帐户www,无登陆权限,挂载bucket:mybucket
Root帐户登陆。vim
一、id www,获取uid、gidcentos
二、root帐户或者其余帐户建立挂载目录 ,修改目录属主:chown -R www:root test1bash
三、echo yiruike-logs:KTAIdXjNEnfEaIHW:8QsUJKGaVOIJFvi11UlbSiZk5vTfhR >> /etc/passwd-ossfsui
四、修改配置文件权限: chmod 600 /etc/passwd-ossfs
修改配置文件属主、属组:chown www:root /etc/passwd-ossfsurl
五、进行挂载centos7
ossfs mybucket test1 -ourl=https://oss-cn-hangzhou.aliyuncs.com -oallow_other -omp_umask=007 -ouid=504 -ogid=0 -odefault_permission=750
说明:spa
url为bucket的Endpoint;
mp_umask为option的取值;
passwd_file=ttpasswd-ossfs为passwd-ossfs 文件的路径code
官方FAQ参考:https://github.com/aliyun/ossfs/wiki/FAQ
常见配置问题:
如下问题出如今非root用户下
ossfs: credentials file /etc/passwd-ossfs should not have others permissions. should not have group permissions
# sudo chmod 640 /etc/passwd-ossfs
could not determine how to establish security credentials
是由于没有找到passwd-ossfs文件,若是在/etc/passwd-ossfs文件已经存在,把它的全部者改为当前用户如www:
# sudo chown www /etc/passwd-ossfs