{"id":4601,"date":"2015-04-26T18:54:57","date_gmt":"2015-04-26T10:54:57","guid":{"rendered":"http:\/\/rmohan.com\/?p=4601"},"modified":"2015-04-26T18:55:35","modified_gmt":"2015-04-26T10:55:35","slug":"linux-acl","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=4601","title":{"rendered":"Linux ACL"},"content":{"rendered":"<p>An access control list (ACL), with respect to a computer file system, is a list of permissions attached to an object. ACL allows you to grant or deny permissions for any user or group on a filesystem resource.<\/p>\n<h2>Enabling ACL<\/h2>\n<p>To enable ACL, edit your \/etc\/fstab file as such:<\/p>\n<pre>\/dev\/VolGroup00\/LogVol00 \/                       ext3    defaults,acl        1 1<\/pre>\n<p>Note: Moderm Redhat distributions enable ACL by default for the root filesystem.<\/p>\n<h2>Set ACL<\/h2>\n<p>To modify ACL use setfacl command. To add permissions use setfacl -m.<\/p>\n<p>Add permissions to some user:<\/p>\n<pre># setfacl -m \"u:username:permissions\"<\/pre>\n<p>or<\/p>\n<pre># setfacl -m \"u:uid:permissions\"<\/pre>\n<p>Add permissions to some group:<\/p>\n<pre># setfacl -m \"g:groupname:permissions\"<\/pre>\n<p>or<\/p>\n<pre># setfacl -m \"g:gid:permissions\"<\/pre>\n<p>Add default ACL:<\/p>\n<pre># setfacl -d -m \"u:uid:permissions\"<\/pre>\n<p>Remove all permissions:<\/p>\n<pre># setfacl -b<\/pre>\n<p>Remove each entry:<\/p>\n<pre># setfacl -x \"entry\"<\/pre>\n<p>To check permissions use:<\/p>\n<pre># getfacl filename<\/pre>\n<h2>Examples<\/h2>\n<p>Set read,write and execute permissions for user \u201cjohndoe\u201d on the file named \u201cabc\u201d.<\/p>\n<pre># setfacl -m \"u:johndoe:rwx\" abc<\/pre>\n<p>Check permissions.<\/p>\n<pre># getfacl abc<\/pre>\n<pre># file: abc\r\n# owner: someone\r\n# group: someone\r\nuser::rw-\r\nuser:johny:rwx\r\ngroup::r--\r\nmask::rwx\r\nother::r--<\/pre>\n<p>Change permissions for user \u201cjohndoe\u201d.<\/p>\n<pre># setfacl -m \"u:johndoe:rw-\" abc<\/pre>\n<p>Check permissions.<\/p>\n<pre># getfacl abc<\/pre>\n<pre># file: abc\r\n# owner: someone\r\n# group: someone\r\nuser::rw-\r\nuser:johndoe:rw-\r\ngroup::r--\r\nmask::r-x\r\nother::r--<\/pre>\n<p>Remove all extended ACL entries.<\/p>\n<pre># setfacl -b abc<\/pre>\n<p>Check permissions.<\/p>\n<pre># getfacl abc<\/pre>\n<pre># file: abc\r\n# owner: someone\r\n# group: someone\r\nuser::rw-\r\ngroup::r--\r\nother::r--<\/pre>\n<h2>Additional Resources<\/h2>\n<pre>man getfacl<\/pre>\n<pre>man setfacl<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>An access control list (ACL), with respect to a computer file system, is a list of permissions attached to an object. ACL allows you to grant or deny permissions for any user or group on a filesystem resource.<\/p>\n<p> Enabling ACL <\/p>\n<p>To enable ACL, edit your \/etc\/fstab file as such:<\/p>\n<p> \/dev\/VolGroup00\/LogVol00 \/ ext3 defaults,acl 1 1 [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,4],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/4601"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4601"}],"version-history":[{"count":1,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/4601\/revisions"}],"predecessor-version":[{"id":4602,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/4601\/revisions\/4602"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4601"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4601"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4601"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}