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?
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 >
Hallo, Igor, Du meintest am 16.08.09:> Is it possible to list samba shares and their contents of a > particular host? --Shell: smbclient -N -L $particular_host shows first all shares of that particular host and then some other stuff. Perhaps you filter some output depending on the key word "Disk" (or "Printer"). Contents: "that depends". You must have some rights. Viele Gruesse! Helmut
Helmut Hullen wrote:> Hallo, Igor, > > Du meintest am 16.08.09: > > >> Is it possible to list samba shares and their contents of a >> particular host? -- >> > > Shell: > > smbclient -N -L $particular_host > > shows first all shares of that particular host and then some other > stuff. Perhaps you filter some output depending on the key word "Disk" > (or "Printer"). > > Contents: "that depends". > You must have some rights. > > Viele Gruesse! > Helmut >Thanks. Yes, I know of that shell command, but I would like to do that directly from python for more flexibility, control and convenience.