connection to samba server

Francis Avila francisgavila at yahoo.com
Sat Dec 13 23:38:18 EST 2003


Przemo Drochomirecki wrote in message ...
>There's a task:
>1) connect to linux samba server from windows application

After <5 minutes of googling, and knowing nothing about windows programming,
it seems that the function you need is WNetAddConnection2:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wnet/wnet/w
netaddconnection2.asp

There is a (very popular) Python package out there which exposes the win32
api.  I'm not sure what it's called. (win32api? pythonwin? win32all?)

>2) compare files from samba server with files from choosen windows
>catalog(s)

What's a windows catalog?

>3) make backup if it's necessary.
>
>So my problem is how to make connection with samba server having triple (IP
>server, login, password) and download/upload
>files. I'm working on Wk2. I was searching for suitable library but found
>nothing.

You need the share name, too, I think, not just server/login/password.

Given what I think you want to do (it's not crystal clear), shouldn't you be
using rsync?  My guess is that you have a bunch of windows clients and you
want to back them all up to a linux server out there somewhere.  Rsync lives
for this stuff.  Random Google for rsync on windows:
http://optics.ph.unimelb.edu.au/help/rsync/rsync_pc1.html Hey, look! Rsync
is hosted by samba!  http://rsync.samba.org/
There's also a port of rsync to python and java (presumably, so you don't
need cygwin?)  Don't know how useful they are, or if they can interop.

Why isn't the network share always connected to the windows clients?  That
way you wouldn't need to back up clients to a server, but just the one
server (whose shares all the windows clients mount) to some other
server/media/drive/whatever, and you can keep all that backup machinery in a
*nix environment.  This is far less complex, no?

Of course, I don't administer windows clients in big, heterogeneous
networks, so feel free to ignore my babblings.
--
Francis Avila





More information about the Python-list mailing list