{"id":19051,"date":"2017-03-01T16:04:00","date_gmt":"2017-03-01T16:04:00","guid":{"rendered":"https:\/\/www.testingdocs.com\/questions\/?p=19051"},"modified":"2021-03-20T13:55:49","modified_gmt":"2021-03-20T13:55:49","slug":"access-control-lists-commands-in-linux","status":"publish","type":"post","link":"https:\/\/www.testingdocs.com\/questions\/access-control-lists-commands-in-linux\/","title":{"rendered":"Access Control Lists Commands in Linux"},"content":{"rendered":"<h3>Overview<\/h3>\n<p>In this tutorial, we will learn two Linux commands for setting and viewing ACLs (Access Control Lists Commands) in Linux. The commands are <strong>getfacl<\/strong> and <strong>setfacl<\/strong> commands. These commands are used to set file or directory permissions.<\/p>\n<h3>setfacl command<\/h3>\n<p>This command sets the Access Control Lists to files and directories on the Linux box. To know more about the command use the man command.<\/p>\n<pre>$ man setfacl<\/pre>\n<p>The useful option is -R flag. This option sets the ACL to all files and folders recursively.<\/p>\n<p>Let&#8217;s create a user and add ACL permission read, write and execute permissions to the user on a sample directory.<\/p>\n<p>$&gt; useradd tDocsUser;<br \/>\nAbsolute path to &#8216;useradd&#8217; is &#8216;\/usr\/sbin\/useradd&#8217;, so running it may require superuser privileges (eg. root).<br \/>\n$&gt; sudo useradd tDocsUser;<br \/>\n[sudo] password for root:<br \/>\n$&gt; mkdir sampleDirectory;<br \/>\n$&gt; touch sampleFile.txt;<br \/>\n$&gt; setfacl -R -m u:tDocsUser:rwx sampleDirectory\/<br \/>\n$&gt;<\/p>\n<h3>getfacl command<\/h3>\n<p>getfacl command reads and displays the current ACLs. For each file, the command displays the file name, owner, group, and ACLs. To know more about the command use the man getfacl command.<\/p>\n<p>Sample usage of the command, to view the current ACL on the directory created:<\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-19056\" src=\"https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/setfacl-Linuc-command.png\" alt=\"setfacl Linux command\" width=\"1825\" height=\"695\" title=\"\" srcset=\"https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/setfacl-Linuc-command.png 1825w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/setfacl-Linuc-command-300x114.png 300w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/setfacl-Linuc-command-1024x390.png 1024w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/setfacl-Linuc-command-768x292.png 768w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/setfacl-Linuc-command-1536x585.png 1536w\" sizes=\"auto, (max-width: 1825px) 100vw, 1825px\" \/><\/p>\n<p>&nbsp;<\/p>\n<h3><\/h3>\n<!--themify_builder_content-->\n<div id=\"themify_builder_content-19051\" data-postid=\"19051\" class=\"themify_builder_content themify_builder_content-19051 themify_builder tf_clear\">\n    <\/div>\n<!--\/themify_builder_content-->\n","protected":false},"excerpt":{"rendered":"<p>Overview In this tutorial, we will learn two Linux commands for setting and viewing ACLs (Access Control Lists Commands) in Linux. The commands are getfacl and setfacl commands. These commands are used to set file or directory permissions. setfacl command This command sets the Access Control Lists to files and directories on the Linux box. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17],"tags":[],"class_list":["post-19051","post","type-post","status-publish","format-standard","hentry","category-linux","has-post-title","has-post-date","has-post-category","has-post-tag","has-post-comment","has-post-author",""],"_links":{"self":[{"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/posts\/19051","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/comments?post=19051"}],"version-history":[{"count":11,"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/posts\/19051\/revisions"}],"predecessor-version":[{"id":19584,"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/posts\/19051\/revisions\/19584"}],"wp:attachment":[{"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/media?parent=19051"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/categories?post=19051"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/tags?post=19051"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}