Accessing password-protected network share

W

wheresjim

I am working on a project that requires me to write files to a network
share (i.e. the path looks like "\\192.168.1.3\images"). Sometimes
this share is password-protected, and I have to map a drive and access
it that way. Is there a way to directly access the password-protected
share without mapping a drive? I know that with http you can add the
username and password in the URL a'la
"http://username:[email protected]/secure". Any hints?
 
M

Monique Y. Mudama

I am working on a project that requires me to write files to a network
share (i.e. the path looks like "\\192.168.1.3\images"). Sometimes
this share is password-protected, and I have to map a drive and access
it that way. Is there a way to directly access the password-protected
share without mapping a drive? I know that with http you can add the
username and password in the URL a'la
"http://username:[email protected]/secure". Any hints?

what about using smb://

?
 
R

Roedy Green

I am working on a project that requires me to write files to a network
share (i.e. the path looks like "\\192.168.1.3\images").
try composing variations with file: on the front.
Remember that \ in Java strings must be doubled. Try to avoid passing
such things on the command line. It gets REALLY hairy then.

See http://mindprod.com/jgloss/main.html
 
F

frickinmonk

The password protection isnt addressed yet...
Waiting curiously.. :-w

Regards,
gc.
 
W

wheresjim

Thanks, Roedy. I actually looked at your page before posting (I'm a
frequent user of your excellent site). I'm still not quite clear on
how to create the URI for the network share with the password. (also
good info on doubling the slashes, though I learned that one the hard
way a while ago).
 
C

Chris Uppal

wheresjim said:
I am working on a project that requires me to write files to a network
share (i.e. the path looks like "\\192.168.1.3\images"). Sometimes
this share is password-protected, and I have to map a drive and access
it that way. Is there a way to directly access the password-protected
share without mapping a drive?

By pure coincidence I happed across

http://jcifs.samba.org/

today. I have no idea how good or bad it is, nor whether the licencing is
compatible with your requirements, but it might be worth a few minutes to check
it out.

-- chris
 
R

Roedy Green

Thanks, Roedy. I actually looked at your page before posting (I'm a
frequent user of your excellent site). I'm still not quite clear on
how to create the URI for the network share with the password. (also
good info on doubling the slashes, though I learned that one the hard
way a while ago).

I don't have experience with Microsoft file shares, but at least I can
show you how to embed a userid/password. Logically I would just expect
smb: then N backslashes or slashes where N is to be found by
experiment followed by the IP. I don't think it has Java support
though since SMB is a MS thing.

See http://mindprod.com/jgloss/uri.html
search for the word "sesame" -- the word I use for the password in
examples.
 
W

wheresjim

Thanks, I tried this package and it works great! Also, Roedy you are
right, it appears a stock Java installation does not support the smb
protocol.
 

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

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top