Steven Haryanto > Setup-Unix-User-0.11 > Setup::Unix::User

Download:
Setup-Unix-User-0.11.tar.gz

Dependencies

Annotate this POD

Website

CPAN RT

Open  0
View/Report Bugs
Module Version: 0.11   Source  

NAME ^

Setup::Unix::User - Setup Unix user (existence, home dir, group memberships)

VERSION ^

This document describes version 0.11 of Setup::Unix::User (from Perl distribution Setup-Unix-User), released on 2014-05-18.

FUNCTIONS ^

add_delete_user_groups(%args) -> [status, msg, result, meta]

Add/delete user from group memberships.

This function is idempotent (repeated invocations with same arguments has the same effect as single invocation). This function supports transactions.

Arguments ('*' denotes required arguments):

Special arguments:

Return value:

Returns an enveloped result (an array).

First element (status) is an integer containing HTTP status code (200 means OK, 4xx caller error, 5xx function error). Second element (msg) is a string containing error message, or 'OK' if status is 200. Third element (result) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information.

adduser(%args) -> [status, msg, result, meta]

Add user.

This function is idempotent (repeated invocations with same arguments has the same effect as single invocation). This function supports transactions.

Arguments ('*' denotes required arguments):

Special arguments:

Return value:

Returns an enveloped result (an array).

First element (status) is an integer containing HTTP status code (200 means OK, 4xx caller error, 5xx function error). Second element (msg) is a string containing error message, or 'OK' if status is 200. Third element (result) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information.

deluser(%args) -> [status, msg, result, meta]

Delete user.

This function is idempotent (repeated invocations with same arguments has the same effect as single invocation). This function supports transactions.

Arguments ('*' denotes required arguments):

Special arguments:

Return value:

Returns an enveloped result (an array).

First element (status) is an integer containing HTTP status code (200 means OK, 4xx caller error, 5xx function error). Second element (msg) is a string containing error message, or 'OK' if status is 200. Third element (result) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information.

setup_unix_user(%args) -> [status, msg, result, meta]

Setup Unix user (existence, group memberships).

On do, will create Unix user if not already exists. And also make sure user belong to specified groups (and not belong to unwanted groups). Return the created UID/GID in the result.

On undo, will delete Unix user (along with its initially created home dir and files) if it was created by this function. Also will restore old group memberships.

This function is idempotent (repeated invocations with same arguments has the same effect as single invocation). This function supports transactions.

Arguments ('*' denotes required arguments):

Special arguments:

Return value:

Returns an enveloped result (an array).

First element (status) is an integer containing HTTP status code (200 means OK, 4xx caller error, 5xx function error). Second element (msg) is a string containing error message, or 'OK' if status is 200. Third element (result) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information.

FAQ ^

How to create user without creating a group with the same name as that user?

By default, group is set to the same name as the user. This will create group with the same name as the user (if the group didn't exist). You can set group to an existing group, e.g. users and the setup function will not create a new group with the same name as user. But note that the group must already exist (if it does not, you can create it first using Setup::Unix::Group).

SEE ALSO ^

Setup

Setup::Unix::Group

HOMEPAGE ^

Please visit the project's homepage at https://metacpan.org/release/Setup-Unix-User.

SOURCE ^

Source repository is at https://github.com/sharyanto/perl-Setup-Unix-User.

BUGS ^

Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=Setup-Unix-User

When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.

AUTHOR ^

Steven Haryanto <stevenharyanto@gmail.com>

COPYRIGHT AND LICENSE ^

This software is copyright (c) 2014 by Steven Haryanto.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

syntax highlighting: