Mount AliyunOSS on ECS's FS use other users.

2019-01-11

So this is my first blog use the Eng…

lolololololol

Install the ossfs package on UR Linux.

At first, all of this u can find it on Document of Aliyun OSS. It will tell u the basic of operation.

And … on the doc we can get that: Use the rpm version of > 7.0 it means u can run it on ur 7.1/7.2/7.3/7.4 of CentOS. I use it on my CentOS 7.4 in bussiness project.

Important! Use other users.

That‘s very esay! If Aliyun’s document hasn’t updated yet, > < u can refer to my practice.

1
2
3
4
5
6
7
8
9
10
11
12
# use root authorit
> adduser gitea # create new user
> id gitea # Get UR basic information for UR user
uid=1001(gitea) gid=1001(gitea) group=1001(gitea)
> mkdir /home/gitea/gitea-repositories # we mount OSS bucket in this file...
> chown -R gitea:root /home/gitea/gitea-repositories # change the owner
> echo "BucketName:AccessKeyID:AccessKeySecret" > /etc/passwd-ossfs # write ur basic secrets in that conifg file for ossfs
> chmod 600 /etc/passwd-ossfs # change file i/o authoraction
> chown -R gitea:root /etc/passwd-ossfs
> umask
0022
> sudo -u gitea /usr/local/bin/ossfs ur-bucket-name /home/gitea/gitea-repositories -ourl=http://bucketEndPoint -omp_umask=0022 -ouid=1001 -ogid=1001 -opasswd_file=/etc/passwd-ossfs -odefault_permission=750

So that’s very easy to mount it if u setup the right config for it. : - )

What we need in the whole process is a clear division and mounting of related resources.

Just a note backup for my self.


Comments: