Access file on another pc (out of domain) with username and passwo

G

Guest

I neeed to write a Windows Service that have to access files on a server in
our network (without domain).
-Our network have NO domain.
-Service run on a win 2003 Server (SERVER_A)
-Files are in a Win 2000 server (SERVER_B)
I have to read and write files in SERVER_B with a specific user (Ex.:
SERVER_B\Jonh) and password (Ex.: 1234) ho can i do that?
I have tried LogonUser API (advapi32.dll) but don't resolve my problem.
Thanks
Ste.
 
M

Mike Lowery

I think if you change the logon properties for the service (run services.msc) to
match the account you want to use on the remote box, it should work. You have
to ensure the same account and password exists on both boxes though.
 
D

David Browne

Mike Lowery said:
I think if you change the logon properties for the service (run
services.msc) to match the account you want to use on the remote box, it
should work. You have to ensure the same account and password exists on
both boxes though.

This is called "workgroup authentication" and it is the only reliable way to
access remote files through windows networking outside of a domain without
an interactive user.

You can access network resources by suppling a user name and password
through the "net use" functionality, or programmatically through the
WNetAddConnection2 API.

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

But this is really more for interactive users. There are a number of
limitations that make this work poorly for services.

David
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top