logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Linux::ACL - Perl extension for reading and setting Access Control Lists for files by libacl linux

Acknowledgements

Author

       Yuriy Nazarov, "<nazarov at cpan.org>"

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.

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

Export

       setfacl($$;$)
           Set  the  ACL  of  the  file or directory named by $path to that specified by $acl.  If $path names a
           directory, then the optional $default_acl argument can also be passed to specify the default ACL  for
           the directory.  See "ACL structure" for information on how the $acl and $default_acl hashes should be
           constructed.

       getfacl($)
           Return a reference to a hash containing information about the file's ACL.  If the file is a directory
           with  a default ACL, then a list is returned, with the first entry being a hash reference to the ACL,
           and the second being a hash reference to  the  default  ACL.   See  "Accessing  ACL  structures"  for
           information  on  how  to access these hashes, and "ACL structure" for information on how these hashes
           are internally constructed.

Name

       Linux::ACL - Perl extension for reading and setting Access Control Lists for files by libacl linux
       library.

Return Values

       setfacl
           returns TRUE if successful and FALSE if unsuccessful.

       getfacl
           if successful, returns a list containing a reference to the hash describing an acl, and, if there  is
           a  default  acl,  a  reference  to  the  hash describing the default acl.  If unsuccessful, "getfacl"
           returns a null list.

Support

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

           perldoc Linux::ACL

       You can also look for information at:

       •   RT: CPAN's request tracker

           <http://rt.cpan.org/NoAuth/Bugs.html?Dist=Linux-ACL>

       •   AnnoCPAN: Annotated CPAN documentation

           <http://annocpan.org/dist/Linux-ACL>

       •   CPAN Ratings

           <http://cpanratings.perl.org/d/Linux-ACL>

       •   Search CPAN

           <http://search.cpan.org/dist/Linux-ACL/>

Synopsis

       Quick summary of what the module does.

       Perhaps a little code snippet.

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

Version

       Version 0.05

See Also