Latest LQ Deal: Latest LQ Deals
Go Back > Blogs > kribor
User Name


Rating: 2 votes, 4.00 average.

HOWTO: Change umask, permissions, ownership etc. of a folder using bindfs

Posted 11-01-2011 at 05:43 PM by kribor

I find myself coming back to a situation where I want to be able to control who files should be created as (user or group) and which permissions the files should have in a specific folder.

For example I have a linux server with a shared music directory for people in the household that is shared using samba and depending on whether how clients connect the files/folders they create get a bunch of different permissions, groups etc.. Getting tired of configuring of trying to configure all the clients perfectly I found the perfect solution: bindfs.

There are two ways to do this, you can either overlay a folder or you can "mount" the folder to a new folder. The syntax is the same but if you want to overlay you just specify the target folder to be the same as the source.

After installing bindfs, executing "bindfs" from the command line gives a pretty simple explanation of the available options. For example I use the following overlay:

bindfs --create-for-group=local-users -glocal-users --create-with-perms=u+rw,g+rw,o+r -pu+rw,g+rw,o+r,o-w /media/music/ /media/music/

This ensures that:
- All files will be created with group: "local-users"
- All files will effectively have group "local-users" (regardless of what they actually have on disk)
- Newly created files will be read/write for the creator and group (similar to umask)
- All existing files will be editable and readable by user and group local-users while others can only read
Posted in Uncategorized
Views 19399 Comments 1
« Prev     Main     Next »
Total Comments 1


  1. Old Comment
    Neat! I'm still new to linux and it's my first time to hear of bindfs - looks like it simplifies file/folder creation.
    Posted 11-01-2011 at 08:53 PM by Phil k. Phil k. is offline


All times are GMT -5. The time now is 07:17 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration