[Samba] Listing all users in a remote Samba server

Necos Secon secon_kun at hotmail.com
Sat Apr 9 21:40:20 GMT 2005


If you're really concerned about security, you can run the code on Samba 
server itself and pipe the output to SSH (if you're running a *nix variant). 
There's a Net::SSH module available for just this purpose. Combine this with 
scp and you can get the output you desire.

Theodore Charles III
Network Administrator
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 17:38:22 -0400
>
>Thanks a lot for your answer.
>
>As a matter of security I really don't want to install network
>client applications on the box. In the other hand this job is part
>of a new webmin module, so the use of external commands unassociate
>with webmin are not available for me :(
>
>Regards,
>
>Erik
>
>Necos Secon wrote:
>
>>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`;
>>
>>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
>>
>
>--
>To unsubscribe from this list go to the following URL and read the
>instructions:  https://lists.samba.org/mailman/listinfo/samba




More information about the samba mailing list