Access WinNT files from Linux using UNC names (not mounts)

Access WinNT files from Linux using UNC names (not mounts)

Post by ron » Wed, 28 Nov 2001 01:25:27



I have Samba up and running between my Linux and NT machines.  I am
working on a client/server program that requires that the Linux
machine update itself with files from NT.  The file locations may
change from time to time, therefore, the NT program sends to the Linux
program (via TCP/IP) the location of the files using UNC format (e.g.
//computername/share/dir).

I am able to access the NT share using smbmount and a mount location
without any problem, but since the share location may not be known
ahead of time, I would like to access the files using the passed UNC
name.

Access using format file:/192.168.1.28/share/dir/file would be okay
also.  Any method of accessing files other than having to do a
smbmount first.

Any ideas?  Thanks!!!

Ron Langham

 
 
 

Access WinNT files from Linux using UNC names (not mounts)

Post by Dean Thompso » Wed, 28 Nov 2001 22:02:26


Hi!,

Quote:> I have Samba up and running between my Linux and NT machines.  I am
> working on a client/server program that requires that the Linux
> machine update itself with files from NT.  The file locations may
> change from time to time, therefore, the NT program sends to the Linux
> program (via TCP/IP) the location of the files using UNC format (e.g.
> //computername/share/dir).

> I am able to access the NT share using smbmount and a mount location
> without any problem, but since the share location may not be known
> ahead of time, I would like to access the files using the passed UNC
> name.

> Access using format file:/192.168.1.28/share/dir/file would be okay
> also.  Any method of accessing files other than having to do a
> smbmount first.

Why can't you use the UNC that you generate and pass it through to the
smbmount?  Basically, you could mount the share on demand and then unmount it
when you don't need it anymore.  Failing that, smbclient will also provide you
access to the files on the system, but this will have an interactive component
to it, which will mean that your program won't be automatic, unless you send a
script or send commands to smbclient.

See ya

Dean Thompson

--
+____________________________+____________________________________________+

| Bach. Computing (Hons)     | ICQ     - 45191180                         |
| PhD Student                | Office  - <Off-Campus>                     |
| School Comp.Sci & Soft.Eng | Phone   - +61 3 9903 2787 (Gen. Office)    |
| MONASH (Caulfield Campus)  | Fax     - +61 3 9903 1077                  |
| Melbourne, Australia       |                                            |
+----------------------------+--------------------------------------------+

 
 
 

1. Using UNC file names in Servlet (Apache/JServ)

Hello,

I have written a servlet to upload files to a network drive. I've
tried to use the UNC pathname but it doesn't work. The message that I
receive is :"...FileNotFoundException...access denied". With a normal
pathname (e.g. d:\InetPub\upload ) it works without problems.
In this example, you can see basicaly what I've done . I've omitted
great part of the code because the problem is here.

(Platform is Intel Windows NT 4.0 Server, running Apache 1.3.6 with
JServ 1.0 B3)

public void doGet (HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException
{

PrintWriter out = res.getWriter();

try
{

String strTest = new String("Testing UNC with OutputStream ");
byte buffer[] = null;
buffer = strTest.getBytes();
File file = new File("\\\\gws1\\InetPub\\testit.txt");
FileOutputStream fout= new FileOutputStream (file);

fout.write(buffer);
fout.close();

catch (Exception e)
{
out.println(e.toString());

....

I have tried various variations of the FileOutputStream consturctor,
i.e. with a String paramater (either drive-mapped or UNC names, with
both doubled back-slashes or forward slashes), or as File object.

If anyone could offer any advice, I would be extremely grateful!

Thanks,

Manuel Burgada

2. help - can't install 3-1/2" floppy drive - it keeps on spinning

3. UNC file names - where's the spec?

4. IRQ problem

5. Can only access web server using IP number not host name...why?

6. Filesystem avail yet for Windows NT???

7. Can I access Linux files through WinNT 4.0/Win95 ?

8. Linux 2.1.131 broke busmouse :-/

9. Dual boot Linux/WinNT; using bootpart not working...

10. .htaccess, domain name access works with numbers, not names

11. How to start named using user named (not root) and SRC?

12. File corruption accessing files on a large-file-enabled fs using RM-Cobol

13. mounting & using WinNT partition