[Samba] python: listing samba shares

Ricardo Jorge rvelhote at gmail.com
Sun Aug 16 08:43:16 MDT 2009


Hi,

Here is some code to get you going. Try it out.

#!/usr/bin/env python

import sys

sys.path.append('/usr/local/samba/lib/python2.6/site-packages')
sys.path.append('/usr/local/samba/lib/python2.6/site-packages/samba')
sys.path.append('/usr/local/samba/lib/python2.6/site-packages/samba/dcerpc')

import param, shares

samba_lp = param.LoadParm()
samba_lp.load_default()

container = shares.SharesContainer(samba_lp)

for share in container:
        print "Path for " + share + ": " + samba_lp.get("path", share)





On Sun, Aug 16, 2009 at 3:37 PM, Igor Katson<descentspb at gmail.com> wrote:
> I've been googling that for a long time, but couldn't find an answer.
> I also checked the python-samba Debian (ubuntu) package contents and even
> compiled samba 4.0.0 alpha8, and checked its python libraries, but couldn't
> find anything regarding viewing the shares contents there.
>
> Is it possible to list samba shares and their contents of a particular host?
> --
> To unsubscribe from this list go to the following URL and read the
> instructions:  https://lists.samba.org/mailman/options/samba
>


More information about the samba mailing list