[Samba] Listing all users in a remote Samba server
secon_kun at hotmail.com
Sat Apr 9 21:25:02 GMT 2005
If you're using perl, you could always use the backticks to get the output
of a command. For example:
my $userlist = `net rpc user -S $server -P $pass`;
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 $go = 1;
$temp = ($userlist =~ m/\n/);
my $chopper = length($temp) + 1;
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
Los Angeles High School
>From: Erik Torres Serrano <erik at bioinfo.cu>
>Reply-To: erik at bioinfo.cu
>To: samba at lists.samba.org
>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
>That's all I have :(
>To unsubscribe from this list go to the following URL and read the
More information about the samba