App-Slaughter
view release on metacpan or search on metacpan
lib/Slaughter/API/freebsd.pm view on Meta::CPAN
}
=head2 UserCreate
Create a new user for the system.
=for example begin
# TODO
=for example end
The following parameters are required:
=over 8
=item Login
The username to create.
=item UID
The UID for the user.
=item GID
The primary GID for the user.
=back
You may optionally specify the GCos field to use.
=cut
sub UserCreate
{
my (%params) = (@_);
#
# Ensure we have the variables we need.
#
foreach my $variable (qw! Login UID GID !)
{
if ( !defined( $params{ $variable } ) )
{
#
# Return undef..
#
return ( $params{ $variable } );
}
}
#
# If the GCos field isn't set then define it.
#
$params{ 'Gcos' } = $params{ 'Login' } if ( !$params{ 'Gcos' } );
# name:uid:gid:class:change:expire:gecos:home_dir:shell:password
my $line =
"$params{ 'Login' }:$params{ 'UID' }:::::$params{ 'Gcos' }::/bin/sh:";
my $cmd = "echo $line | adduser -G wheel -q -w random -f -";
RunCommand( Cmd => $cmd );
}
1;
=head1 AUTHOR
Steve Kemp <steve@steve.org.uk>
=cut
=head1 LICENSE
Copyright (c) 2010-2015 by Steve Kemp. All rights reserved.
This module is free software;
you can redistribute it and/or modify it under
the same terms as Perl itself.
The LICENSE file contains the full text of the license.
=cut
( run in 1.806 second using v1.01-cache-2.11-cpan-ceb78f64989 )