Permission commands for new folders
I have a 4TB USB storage device connected to my Ubuntu server, It's overkill, but I don't have to worry about storage at all. My Docker folders are on that device and they are backed up to my NAS with Duplicati and all works well.
The first time I used it, I couldn't get any app with a database working at all. Whether it was MySQL, PostgreQL or MariaDB, none of them worked.
Not just with databases, sometimes with folders where a file would automatically move from one to another upon completion. In those cases, every time I ran a new Docker compose I found that the Docker container stopped, or the logs showed an 'access denied' message, or something similar.
The reason was that the USB storage device had been formatted with NTFS. With that, I couldn't get Linux to over-ride any permissions. The NTFS format, although very accessible, would just not accept any Linux permission commands.
So I wiped it and formatted it with EXT4, instead of NTFS. It worked.
I am now able to over-write permissions if needed and the Docker containers run without a hitch.
These are the two commands, I generally use on the affected Docker directories:
sudo chown -R $USER:$USER /docker/<directory>
sudo chmod -R a=,a+rX,u+w,g+w /docker/<directory>
I am no expert in Linux and hopefully these two lines don't open my server to an unnecessary security risk.
If necessary, I will update as I learn more.
No Comments