mkogg.py: Fix 'self.get_mp4_metadata(self, source)'
[blog.git] / posts / ACL.mdwn
1 [[!meta  title="Access Control Lists"]]
2
3 On Gentoo, [[MPD]] runs as `mpd.audio`, and it creates playlists with
4 644 permissions (`-rw-r--r--`).  However, I wanted other members of
5 the audio group (i.e. me), to also have read/write permissions.  This
6 would allow me to sort/shuffle/create/etc. playlists from the command
7 line without going through MPD.
8
9 Browsing around, I ran across [Access Control Lists][ACL] ([nice
10 howto][howto]).  The solution is to add a default ACL to the playlist
11 directory:
12
13     $ setfacl -d -m g:audio:rw- playlist
14                 $ getfacl --omit-header playlists
15     user::rwx
16     group::rwx
17     other::r-x
18     default:user::rwx
19     default:group::rwx
20     default:group:audio:rw-
21     default:mask::rwx
22     default:other::r-x
23
24 after which new files created in playlist will have `audio` read/write
25 permissions:
26
27     $ getfacl --omit-header playlists/xyz.m3u 
28     user::rw-
29     group::rwx                      #effective:rw-
30     group:audio:rw-
31     mask::rw-
32     other::r--
33
34 Several other utilities have special ACL handling (see `acl(5)`).  For
35 example, `ls` shows the presence of an ACL with a `+`:
36
37     $ ls -l playlists/xyz.m3u 
38     -rw-rw-r--+ 1 wking wking 0 Dec 11 17:41 playlists/xyz.m3u
39
40 [ACL]: http://en.wikipedia.org/wiki/Access_control_list
41 [howto]: http://wiki.kaspersandberg.com/doku.php?id=howtos:acl
42
43 [[!tag tags/linux]]