Linux::ACL(3pm)

✨ Linux::ACL ✨

okay bestie, so this is Linux::ACL β€” a Perl extension for reading and setting Access Control Lists for files, powered by the libacl linux library. yes you read that right, we're doing ACLs today and we're gonna slay it πŸ’…


🌸 VERSION 🌸

Version 0.05 β€” lil baby version number but she's iconic πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

so like, quick vibes-only summary of what the module does. Perhaps a little code snippet. (fr fr, that's the vibe.)

use Linux::ACL;
($acl, $default_acl) = getfacl("path/to/file");
setfacl("path/to/file", $acl [, $default_acl]);

πŸ’– EXPORT πŸ’–

setfacl($$;$)

Sets the ACL of the file or directory named by $path to whatever $acl says. important detail alert: if $path names a directory, then the optional $default_acl argument can also be passed to specify the default ACL for that directory. and like... how do you even build the $acl and $default_acl hashes?? go read "ACL structure" bestie, it's all there, no cap πŸ“–

getfacl($)

Returns a reference to a hash with info about the file's ACL. plot twist: if the file is a directory with a default ACL, then you get back a list, where entry one is a hash reference to the ACL and entry two is a hash reference to the default ACL 🫢

Need to know how to access these hashes? That's "Accessing ACL structures". Wanna know how the hashes are internally constructed? That's "ACL structure". Both important, both iconic, go read them ✨


πŸ”₯ RETURN VALUES πŸ”₯

  • setfacl β€” returns TRUE if it went well and FALSE if it didn't 😭
  • getfacl β€” if successful, returns a list containing a reference to the hash describing an acl, and (if there's a default acl) a reference to the hash describing that default acl. If unsuccessful, getfacl returns a null list. devastating. πŸ’€

Examples πŸ‘‘

getfacl example

use Linux::ACL;
use Data::Dumper;
my @a = getfacl("/tmp");
print Dumper \@a;

prints:

$VAR1 = [
        {
          'uperm' => {
                       'w' => 1,
                       'r' => 1,
                       'x' => 1
                     },
          'gperm' => {
                       'w' => 1,
                       'r' => 1,
                       'x' => 1
                     },
          'other' => {
                       'w' => 1,
                       'r' => 1,
                       'x' => 1
                     }
        }
      ];

setfacl example

use Linux::ACL;
setfacl("/mnt/testacl/d", {
      uperm=>{r=>1,w=>1,x=>1},
      gperm=>{r=>1,w=>1,x=>1},
      other=>{r=>1,w=>0,x=>1},
      mask=>{r=>1,w=>1,x=>1},
      group=>{
              123456=>{r=>1,w=>1,x=>1}
      }
}, {
      uperm=>{r=>1,w=>1,x=>1},
      gperm=>{r=>1,w=>1,x=>1},
      other=>{r=>1,w=>1,x=>1},
      mask=>{r=>1,w=>1,x=>1}
});
system("getfacl /mnt/testacl/d");

prints:

$ getfacl d
# file: d
# owner: user
# group: user
user::rwx
group::rwx
group:123456:rwx
mask::rwx
other::r-x
default:user::rwx
default:group::rwx
default:mask::rwx
default:other::rwx

look at that output. she ate. periodt. 🌈


🌟 AUTHOR 🌟

Yuriy Nazarov, "<nazarov at cpan.org>" β€” ty king 🫑


😭 BUGS 😭

Please report any bugs or feature requests to "bug-linux-acl at rt.cpan.org", or through the web interface at <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Linux-ACL>. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. mutual updates, we love a communicative relationship πŸ’Œ


πŸ’œ SUPPORT πŸ’œ

You can find documentation for this module with the perldoc command.

perldoc Linux::ACL

You can also look for information at:

iykyk, all the links, all the lore πŸŽ€


🧚 ACKNOWLEDGEMENTS 🧚

(no notes here, bestie β€” this section is literally empty in the original, and honestly? respect for the restraint 🫢)


Copyright 2013 Yuriy Nazarov.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See <http://dev.perl.org/licenses/> for more information.


and that's the whole page babes!! this masterpiece ships as perl v5.42.3, dated 2026-08-19, no cap πŸ’…βœ¨ β€” go set some ACLs, you're the main character now πŸ’–

πŸ“¦ where this page comes from