• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Access password protected remote (shared) folder

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi everyone,

I have an issue while trying to to access a password protected remote (shared) folder from a non-web java application...

So far, I'm able to do so if it would not be password protected by just using java.oi.File and accessing the folder as if it is local but I don't know how I can achieve the same thing when it is password protected, I mean, I know it would be easier if I can access this "resource" through an HTTP request or similar but, since it's file protocol, I could not find much information.

I've also looked at URL and URLConnection classes and it's the same thing, when there is no user / password restriction, I'm able to get there, otherwise, I'm not so, I don't know if I'm missing something with those classes or if there's any way I can pass username / password as parameters when accessing this remote (shared) folder using the file protocol...

Hopefully you guys can help me out on this one, thanks in advance...



Regards,
Julio Fernandez
 
Rancher
Posts: 43081
77
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What kind of file server is this? If it's SMB, then the jCIFS library (jcifs.samba.org) can access password-protect files. Its API mimics the File/FileInputStream/FileOutputStream classes exactly, so it should not be hard to adapt your code to it.
 
Julio Fernandez
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ulf,

Thanks for the quick reply!, Although I'm not 100% sure, it's most likely Samba so, let me check the jCIFS library to see how it works...



Regards,
Julio Fernandez
 
Sheriff
Posts: 22784
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If it's a Windows share, that's SMB alright. Samba is the name of the main UNIX library to access SMB shares.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic