{"id":15,"date":"2017-10-08T03:48:00","date_gmt":"2017-10-08T03:48:00","guid":{"rendered":"https:\/\/linuxadmin.melberi.com\/uncategorized\/how-to-set-acl-in-linux"},"modified":"2017-10-08T08:25:47","modified_gmt":"2017-10-08T08:25:47","slug":"how-to-set-acl-in-linux","status":"publish","type":"post","link":"https:\/\/www.melberi.com\/linuxadmin\/acl\/how-to-set-acl-in-linux","title":{"rendered":"How to set ACL in linux Directory Partition File"},"content":{"rendered":"<p>How to set ACL in Redhat Fedora Cent OS Ubuntu Linux File System, Directory and Partitions in Command Line.<\/p>\n<h2><span style=\"text-decoration: underline;\">Set ACL Linux<\/span><\/h2>\n<div style=\"color: black;\">\n<h3><u><b>Step 1<\/b><\/u><\/h3>\n<\/div>\n<div style=\"color: black;\">Enable ACL support on the partition.<\/div>\n<div style=\"color: black;\"><\/div>\n<div style=\"color: black;\">Edit <strong>\/etc\/fstab<\/strong> file and change the default parameter to rw,acl<\/div>\n<div><\/div>\n<div style=\"color: black;\">If you want to enable acl for \/home<\/div>\n<div style=\"color: black;\"><\/div>\n<pre style=\"background-color: #cccccc; color: black;\">LABEL=\/                 \/                       ext3    defaults        1 1\r\nLABEL=\/boot             \/boot                   ext3    defaults        1 2<\/pre>\n<pre style=\"background-color: #cccccc; color: black;\">LABEL=\/home             \/home                   ext3    rw,acl          1 2\r\nLABEL=\/tmp              \/tmp                    ext3    defaults        1 2\r\nLABEL=\/usr              \/usr                    ext3    defaults        1 2\r\nLABEL=\/var              \/var                    ext3    defaults        1 2\r\n\/dev\/hda8               swap                    swap    defaults        0 0\r\n\/dev\/hdd1               \/Data                   ext3    ro,noatime      1 2\r\nLABEL=\/XFS              \/XFS                    xfs     rw,noatime      0 2<\/pre>\n<div style=\"color: black;\"><\/div>\n<div style=\"color: black;\">Reboot the system.<\/div>\n<div style=\"color: black;\">If the partition is not in use, you can unmount and remount the partition<\/div>\n<div style=\"color: black;\"><\/div>\n<div style=\"background-color: #cccccc; color: black;\">#sudo umount \/home<\/div>\n<div style=\"background-color: #cccccc; color: black;\">#sudo mount \/home<\/div>\n<div style=\"color: black;\">\n<h3><u><b>Step 2<\/b><\/u><\/h3>\n<\/div>\n<div style=\"color: black;\">Create user and group<\/div>\n<div style=\"color: black;\"><\/div>\n<div style=\"background-color: #cccccc; color: black;\">#useradd user1<\/div>\n<div style=\"background-color: #cccccc; color: black;\">#groupadd group1<\/div>\n<div style=\"background-color: #cccccc; color: black;\">#usermod -a -G group1 user1<\/div>\n<div style=\"color: black;\"><\/div>\n<div style=\"color: black;\">\n<h3><u><b>Step 3<\/b><\/u><\/h3>\n<\/div>\n<div style=\"color: black;\">Default ACL<\/div>\n<div style=\"color: black;\"><\/div>\n<div style=\"color: black;\">Now you can enable ACL by using setfacl command<\/div>\n<div style=\"color: black;\"><\/div>\n<div style=\"background-color: #cccccc; color: black;\"><strong>#mkdir \/home\/folder1<\/strong><\/div>\n<div style=\"background-color: #cccccc; color: black;\"><strong>#chgrp group1 \/home\/folder1<\/strong><\/div>\n<div style=\"background-color: #cccccc; color: black;\"><strong>#chmod g+w \/home\/folder1<\/strong><\/div>\n<div style=\"background-color: #cccccc; color: black;\"><strong>#setfacl &#8211;set u::rwx,g::r-x,o::- \/home\/folder1<\/strong><\/div>\n<div style=\"background-color: white; color: black;\">\n<p>To set ACL<\/p>\n<\/div>\n<div style=\"background-color: #cccccc; color: black;\"><b>#setfacl -d &#8211;set u::rwx,u:user1:rwx,g::rx,g:group1:rx,o::- \/home\/folder1<\/b><\/div>\n<div style=\"background-color: #cccccc; color: black;\">\n<p>To view the acl<\/p>\n<\/div>\n<div style=\"background-color: #cccccc; color: black;\"><b># getfacl \/home\/folder1\/<\/b><\/div>\n<div style=\"background-color: white; color: black;\"><\/div>\n<div style=\"color: black;\"># file: home\/folder1\/<br style=\"background-color: white;\" \/># owner: root<br style=\"background-color: white;\" \/># group: group1<br style=\"background-color: white;\" \/>user::rwx<br style=\"background-color: white;\" \/>group::r-x<br style=\"background-color: white;\" \/>other::&#8212;<br style=\"background-color: white;\" \/>default:user::rwx<br style=\"background-color: white;\" \/>default:user:user1:rwx<br style=\"background-color: white;\" \/>default:group::r-x<br style=\"background-color: white;\" \/>default:group:group1:r-x<br style=\"background-color: white;\" \/>default:mask::rwx<br style=\"background-color: white;\" \/>default:other::&#8212;<\/div>\n<div style=\"color: black;\"><\/div>\n<div style=\"color: black;\"><\/div>\n<div style=\"color: black;\"><\/div>\n","protected":false},"excerpt":{"rendered":"<p>How to set ACL in Redhat Fedora Cent OS Ubuntu Linux File System, Directory and Partitions in Command Line. Set ACL Linux Step 1 Enable ACL support on the partition&#8230;. <a href=\"https:\/\/www.melberi.com\/linuxadmin\/acl\/how-to-set-acl-in-linux\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[99,100],"tags":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.melberi.com\/linuxadmin\/wp-json\/wp\/v2\/posts\/15"}],"collection":[{"href":"https:\/\/www.melberi.com\/linuxadmin\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.melberi.com\/linuxadmin\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.melberi.com\/linuxadmin\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.melberi.com\/linuxadmin\/wp-json\/wp\/v2\/comments?post=15"}],"version-history":[{"count":3,"href":"https:\/\/www.melberi.com\/linuxadmin\/wp-json\/wp\/v2\/posts\/15\/revisions"}],"predecessor-version":[{"id":447,"href":"https:\/\/www.melberi.com\/linuxadmin\/wp-json\/wp\/v2\/posts\/15\/revisions\/447"}],"wp:attachment":[{"href":"https:\/\/www.melberi.com\/linuxadmin\/wp-json\/wp\/v2\/media?parent=15"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.melberi.com\/linuxadmin\/wp-json\/wp\/v2\/categories?post=15"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.melberi.com\/linuxadmin\/wp-json\/wp\/v2\/tags?post=15"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}