阿里云ossfs配置

Github下载:https://github.com/aliyun/ossfs/wiki

# 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_mountpoint

前提:挂载目录test1,账户www,无登录权限,挂载bucket:mybucket
Root账户登录。

1、# id www ->504 ,获取uid、gid

2、root账户或者其他账户创建挂载目录 ,然后修改目录属主:chown -R www:root test1

3、echo yiruike-logs:KTAIdXjNEnfEaIHW:8QsUJKGaVOIJFvi11UlbSiZk5vTfhR >> /etc/passwd-ossfs

4、修改配置文件权限:         chmod 600 /etc/passwd-ossfs
     修改配置文件属主、属组:chown www:root /etc/passwd-ossfs

5、进行挂载

ossfs mybucket test1 -ourl=https://oss-cn-hangzhou.aliyuncs.com -oallow_other -omp_umask=007 -ouid=504 -ogid=0 -odefault_permission=750

     说明:

           url为bucket的Endpoint;
           mp_umask为option的取值;
           passwd_file=ttpasswd-ossfs为passwd-ossfs 文件的路径

如果只给除root用户以外的用户只读权限的放,只加-oallow_other即可。

卸载:

# fuser -vm /tmp/myoss 

官方FAQ参考:https://github.com/aliyun/ossfs/wiki/FAQ

常见配置问题:

以下问题出现在非root用户下

执行echo ××××> /etc/passwd-ossfs  bash: /etc/passwd-ossfs: Permission denied
使用sudo vim 在/etc下新建就可以,将echo等内容拷贝进去
 

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

 
 
配置其他路径passwd-ossfs文件
ossfs my-bucket  my-mount-point -ourl=my-oss-endpoint  -opasswd_file=/home/work/passwd-ossfs
 
 
 
原文地址:https://www.cnblogs.com/wjoyxt/p/10769970.html