473,378 Members | 1,421 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

connection to samba server

hi,
does anyone knows how to connect to samba server (from windows)

thx in adv.
Przemo
Jul 18 '05 #1
7 4898
Przemo Drochomirecki wrote:
hi,
does anyone knows how to connect to samba server (from windows)

Yes.

Also, read http://www.catb.org/~esr/faqs/smart-questions.html

--Irmen

Jul 18 '05 #2
very funny, ok, so now it sounds like this:
(damn smart way)

I used Google to try to find "connecting to samba server"" on the Web, but I
got no useful hits. Does anyone know where I can find programming
information on this problem?

- Przemo
Jul 18 '05 #3
On Sun, 14 Dec 2003 03:33:31 -0800, "Przemo Drochomirecki" <pe******@gazeta.pl> wrote:
very funny, ok, so now it sounds like this:
(damn smart way)

I used Google to try to find "connecting to samba server"" on the Web, but I
got no useful hits. Does anyone know where I can find programming
information on this problem?

Which problem is your problem? Do you have a samba server running? On what?
Do you have privileges to configure it (even though you don't have sufficient
knowledge at this point)? What version of windows are you running? What connects
the two? Are you trying to connect with a program or browsing "network neighborhood"?
What makes you think there is a problem? What have you tried/observed? Why are we
playing 20-questions?

Regards,
Bengt Richter
Jul 18 '05 #4
There's a task:
1) connect to linux samba server from windows application
2) compare files from samba server with files from choosen windows
catalog(s)
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.

Regards
Przemek Drochomirecki
Jul 18 '05 #5
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/de...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_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

Jul 18 '05 #6
Francis Avila wrote:
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/de...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?)


win32all:

http://starship.python.net/crew/mhammond/win32/

but I'm pretty sure you can use os.system("net use ...") as well...

</F>


Jul 18 '05 #7
"Przemo Drochomirecki" <pe******@gazeta.pl> wrote...
does anyone knows how to connect to samba server (from windows)


Hello there.

Your question isn't particularly clear, however I can assume you mean
something more like "can anyone help me establish a connection to a
Samba server from Python under Windows?"

In which case, the clearest solution might be to use a suitable
Windows API call to map the remote Samba computer's share to a local
drive letter, then just access the remote Samba files via that drive
letter, eg.:

def map_drive(local, remote, username = None, password = None):
return win32wnet.WNetAddConnection2(
win32netcon.RESOURCETYPE_DISK,
local, remote, None,
username, password,
0
)

def unmap_drive(...):
...

map_drive("Z:", r"\\mum\my_share")
# <use os.listdir to determine contents of Z:, and process>
unmap_drive("Z:")
Alternatively if your share does not require authentication (ie. you
are pre-authenticated to the Samba server, or it has guest shares),
you may directly use UNC pathnames to access the share, eg.:

# will throw 'invalid argument' if you are not authenticated.
os.chdir(r"\\mum\my_share")
os.listdir(".")
# etc.
Alternatively, you could prepend the UNC path to each file you wish to
access, although this may be considerably slower:

to_process = [ 'input1.txt', 'input2.txt', 'job.ctl' ]
unc_path = r'\\mum\my_share'

for filename in to_process:
pathname = os.path.join(unc_path, filename)
processee = open(pathname)

...
Hope that helps. To the other respondees, answering in the unhelpful
manner that you did makes you no more than trolls. Has it ever crossed
your mind that in some parts of the world, the education necessary to
communicate in the accepted pythonic anal way, might not be readily
available?

You may argue that it is better to teach someone how to ask a question
correctly, but I would rather see it as being a poor example of your
community.

It is quite possible (gathering from the way he posted) that this
poster has never before talked on a Python user list. How do you think
he feels about his first experience with fellow Python programmers,
good or bad?

Nothing agitates me more on the Internet than people wasting each
other's time in this manner. True, the poster wasn't particularly
clear, but do you have a right to demand he posts in clear well
defined English?

The Internet is a global medium, and despite popular assumption,
English is not an Internet standard. I have as much right to post in
native Belfast slang as you have to post in well written English.
Please learn to be accepting of one another, it is so much more
helpful than to try to correct something that shouldn't be corrected.
The original poster was well meaning, was your reply?

If you didn't understand the question then don't reply. Others may
well do, and the poster will quickly work out whether or not he is
being clear by the number of replies he receives.

By doing the usual "person isn't being clear, lets make an example of
him" dance, you wasted not only your own time, but his, everyone who
reads your pointless thread, and some megabytes of Internet bandwidth
to boot.

Goodnight,
David.
Jul 18 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Josef Dalcolmo | last post by:
Hello, can anyone tell me how to find the list of computer names on a samba network, and the list of shared folders / devices on a samba networked computer? We have a GNU/Debian Server, and...
6
by: tc | last post by:
Does anyone know of a module for python which simulates a samba server (windows fileshare). Instead of sharing a Phisical Device I'd like to share a database based filesystem which is spread over...
2
by: Tyler Sample | last post by:
I've got a Samba share set up on a LINUX box. It's set up for user-level access. A Windows user is mapped to a UNIX user. When accessing through file explorer, a username/password box pops up,...
1
by: jon wackley | last post by:
Hi All, Hope that this is the correct group to post this in, I'm quite stuck and have tried a great number of things including the MS knowledgebase, google, and other resources. I created a...
1
by: Michael D. Ober | last post by:
I have an ASP.NET 2.0 base site that needs to access files on Snap Appliance's Guardian OS 4.2, which is running SAMBA 3.x which is a domain member on the network. How do I get our web-server,...
4
by: Thyagu | last post by:
Hi, Is it possible to connect to SQL Server using trusted connection from unix? If yes, I'd like to know how. Regards, Thyagu.
0
by: mvrk | last post by:
Hi, I got a Samba server configured on my Fedora 7 with LDAP authentication, when i try to login with a user that exists on the LDAP but doesn't exists on the system it just gives this msg: ...
1
by: symbioid | last post by:
Hello, I'm working on a project, and VMware has problems with suspending the virtual machine. We are accessing the machine through samba. However, when I suspend the VM, it stops the Samba...
1
by: rakesh19 | last post by:
Hi, Can I embed images from a samba file server on the intranet in a web application? Rakesh
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.