my $userlist = `net rpc user -S $server -P $pass`;
or
my @userlist = `net rpc user -S $server -P $pass`;
I forget if the net commands support passing a password to it, but if it does, then your job is done. Also, if I recall, the output of net rpc user is newline delimited, so you'll have to parse it with a couple of regexes. Something like this might work:
my @users;
my $go = 1;
while ($go)
{
my $temp;
$temp = ($userlist =~ m/\n/);
my $chopper = length($temp) + 1;
reverse($userlist);
while ($chopper)
{
chop($userlist);
$chopper--;
}
reverse($userlist);
if ( length($userlist) <= 1 )
{
$go = 0;
}
}Untested and I know the algorithm could be a lot better. But, maybe this'll give you some direction.
Theodore Charles III Network Administrator Los Angeles High School
>From: Erik Torres Serrano <[EMAIL PROTECTED]> >Reply-To: [EMAIL PROTECTED] >To: [email protected] >Subject: Re: [Samba] Listing all users in a remote Samba server >Date: Sat, 09 Apr 2005 15:02:22 -0400 > >Paul Gienger wrote: > >> >>>I'm trying to develop a service for retrieving the entire user >>>list of a remote samba server. The expected result is the same >>>expected from the use of the samba command: >>> >>>net rpc user >>> >>Depending on your backend, there's several ways to go about it, >>including querying LDAP for the entries with an appropriate filter >>and parsing the smbpasswd file. I believe you could also get some >>info out of pdbedit, but that could be a bit tedious. >>What is your backend? > >Ok, what I have is a standalone Samba server without ADS or LDAP. >Users are managed in a smbpasswd file. In the other side I have a >Linux box running webmin. Both servers are in the same LAN. What I >need is an App to be included in webmin (that's why I need Perl) in >the second box for listing all users in the Samba server. >I saw that net command use a RPC request but I didn't find how to do >the same. >That's all I have :( > >Regards, > >Erik > >-- >To unsubscribe from this list go to the following URL and read the >instructions: https://lists.samba.org/mailman/listinfo/samba
-- To unsubscribe from this list go to the following URL and read the instructions: https://lists.samba.org/mailman/listinfo/samba
