Code Monkey home page Code Monkey logo

raku-unix-privileges's Introduction

UNIX::Privileges

A module for handling UNIX privileges

Example

Synopsis:

use UNIX::Privileges;

UNIX::Privileges::userinfo($user);
UNIX::Privileges::chown($user, $file);
UNIX::Privileges::drop($user);
UNIX::Privileges::chroot($directory);

You can also do

use UNIX::Privileges :ALL;

userinfo($user);
chown($user, $file);
drop($user);
chroot($directory);

The :CH tag will import chown and chroot and the USER tag will import only USER.

Example usage:

use UNIX::Privileges;

UNIX::Privileges::chown("nobody", "test.txt");
UNIX::Privileges::drop("nobody");

Example with a chroot:

use UNIX::Privileges;

my $user = UNIX::Privileges::userinfo("nobody");
UNIX::Privileges::chown($user, "/tmp/test.txt");
UNIX::Privileges::chroot("/tmp");
# once in the chroot access to the system password file is lost
# therefore UNIX::Privileges::drop("nobody") will no longer work
# as the system cannot find the uid or gid of "nobody" anymore
# fortunately we already have this information in the $user var
# that we defined above by calling UNIX::Privileges::userinfo
# just remember you have to do this *before* creating the chroot
UNIX::Privileges::drop($user);

Installation

Assuming ypu have a working Rakudo installation you can install this with zef :

zef install UNIX::Privileges

Some of the tests won't be run unless they are run as 'root', and you may not be comfortable running a remote installer with escalated privileges, so you may want to checkout or otherwise download this package, run the 'root' tests with something like:

sudo zef test .

(assuming that the Rakudo toolchain is in the global PATH.)

Support

Please send any suggestions or patches via https://github.com/jonathanstowe/raku-unix-privileges/issues

License & Copyright

This is free software, please see the LICENCE file in the distribution.

© carlin 2015 © Jonathan Stowe 2017 - 2020

raku-unix-privileges's People

Contributors

cbvi avatar jj avatar jonathanstowe avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

jj

raku-unix-privileges's Issues

Fails to install with latest raku, zef

===> Building: UNIX::Privileges:ver<0.1.3>:auth<github:jonathanstowe>:api<1.0>
[UNIX::Privileges] Command: /home/jmerelo/.rakudobrew/versions/moar-2020.06/install/bin/rakudo -I/home/jmerelo/.zef/store/P6-LibraryMake.git/8ab4b23a981ebfd63a74c11d1398750a472195aa -I/home/jmerelo/.zef/store/Shell-Command.git/a0f1d295f80777f5809af452b85ff80feb648e3b -I/home/jmerelo/.zef/store/perl6-file-which.git/1dfbeba2f92f8b2b04e8b26619eb20d599198d25 -I/home/jmerelo/.zef/store/File-Find.git/5754d97b25cbf3b6abe997a9d829eac4e5aba7d9 -e require '/home/jmerelo/.zef/store/UNIX-Privileges-0.1.3.tar.gz/UNIX-Privileges-0.1.3/Build.pm'; ::('Build').new.build('/home/jmerelo/.zef/store/UNIX-Privileges-0.1.3.tar.gz/UNIX-Privileges-0.1.3') ?? exit(0) !! exit(1);
[UNIX::Privileges] ===SORRY!=== Error while compiling /home/jmerelo/.zef/store/UNIX-Privileges-0.1.3.tar.gz/UNIX-Privileges-0.1.3/Build.pm
[UNIX::Privileges] Could not find LibraryMake in:
[UNIX::Privileges]     file#/home/jmerelo/.zef/store/P6-LibraryMake.git/8ab4b23a981ebfd63a74c11d1398750a472195aa
[UNIX::Privileges]     file#/home/jmerelo/.zef/store/Shell-Command.git/a0f1d295f80777f5809af452b85ff80feb648e3b
[UNIX::Privileges]     file#/home/jmerelo/.zef/store/perl6-file-which.git/1dfbeba2f92f8b2b04e8b26619eb20d599198d25
[UNIX::Privileges]     file#/home/jmerelo/.zef/store/File-Find.git/5754d97b25cbf3b6abe997a9d829eac4e5aba7d9
[UNIX::Privileges]     inst#/home/jmerelo/.raku
[UNIX::Privileges]     inst#/home/jmerelo/.rakudobrew/versions/moar-2020.06/install/share/perl6/site
[UNIX::Privileges]     inst#/home/jmerelo/.rakudobrew/versions/moar-2020.06/install/share/perl6/vendor
[UNIX::Privileges]     inst#/home/jmerelo/.rakudobrew/versions/moar-2020.06/install/share/perl6/core
[UNIX::Privileges]     ap#
[UNIX::Privileges]     nqp#
[UNIX::Privileges]     perl5#
[UNIX::Privileges] at /home/jmerelo/.zef/store/UNIX-Privileges-0.1.3.tar.gz/UNIX-Privileges-0.1.3/Build.pm:4

`zef`` version:

v0.8.5

Exports?

Wondering whether it might be an idea to supply some tagged exports to save typing.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.