How to resolve s3fuse writing files as root ?
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:
I put a lot of thoughts into these blogs, so I could share the information in a clear and useful way. If you have any comments, thoughts, questions, or you need someone to consult with,
feel free to contact me via LinkedIn: