When you install s3fuse to mount AWS S3 bucket as local folder in your linux machine, you may encounter a scenario – where file are uploaded to the S3 bucket and the ownership of your files on your folder are marked as owned by root user instead of the normal ubuntu user.
The problem is that s3fuse has mounted the file as root user and no other user was configured. Another source of problem would be an old version.
The solution to s3fuse permissions problems:
- The first step is to change the config file of fuse and unmark “user_allow_other“
sudo nano /etc/fuse.conf
2. Find out the uid and gid of your ubuntu linux user:
id -u ubuntu
id -g ubuntu
3. Umount your partition if it is already mounted and re-mount the partition with -o allow_other, and UID, GID from section 2 :
s3fs myBucket:/ /home/ubuntu/airflow/dags -o allow_other -o use_rrs -o allow_other -o use_cache=/tmp -o uid=1000 -o gid=1000
4. Test via uploading a file to s3 bucket and see the permission on the same file one the linux OS level:
ls -la
Sources:
https://kb.iu.edu/d/adwf
https://www.howtoinstall.me/ubuntu/18-04/s3fs/
https://stackoverflow.com/questions/9764401/change-user-ownership-of-s3fs-mounted-buckets