Passwd::Samba
use Passwd::Samba; my $ps = Passwd::Samba->new(); my $err = $ps->passwd("example", "_plain_text_secret_" ); foreach my $user ($ps->users) { print "Username: $user\nUID: ", $ps->uid($user), "\n\n"; } my $uid = $ps->uid('example'); $ps->rename('example', 'new_example'); $pu->del('new_example'); # or use Passwd::Samba qw(del uid maxuid passwd rename users); my $err = passwd("example", "_plain_text_secret_" ); foreach my $user (users()) { print "Username: $user\nUID: ", uid($user), "\n\n"; } my $uid = uid('example'); rename('example', 'new_example'); del('new_example');
The Passwd::Samba module provides an abstract interface to /etc/samba/smbpasswd format files. It is inspired by Unix::PasswdFile module.
Constructor. Possible parameters are:
/etc/samba/smbpasswd
This method will delete the list of users. It has no effect if the supplied user does not exist.
This method returns the maximum UID in use by all users.
Modify a user's password. Returns the result of operation (TRUE or FALSE).
This method changes the username for a user. If NEWNAME corresponds to an existing user, that user will be overwritten. It returns FALSE on failure and TRUE on success.
Read or modify a user's UID. Returns the result of operation (TRUE or FALSE) if UID was specified otherwhise returns the UID.
This alias for passwd. User is created if doesn't exists.
This method returns a list of all existing usernames.
This method, if called with an argument, sets path to the smbpasswd file. Otherwise returns the current PATH.
None known.
Strzelecki Łukasz <lukasz@strzeleccy.eu>
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
See http://www.perl.com/perl/misc/Artistic.html
1 POD Error
The following errors were encountered while parsing the POD:
Non-ASCII character seen before =encoding in 'Łukasz'. Assuming UTF-8
To install Passwd::Samba, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Passwd::Samba
CPAN shell
perl -MCPAN -e shell install Passwd::Samba
For more information on module installation, please visit the detailed CPAN module installation guide.