LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 01-25-2006, 09:55 AM   #1
humbletech99
Member
 
Registered: Jun 2005
Posts: 374

Rep: Reputation: 30
use a file off a network?


Hi,
I'd like to know if it is possible to use a file off a network share (smbfs) the same way that you can do in windows via the \\hostname\share\path\to\file.

I've tried doing things like:

Code:
cat //hostname/share/path/to/file
cat smbfs://hostname/share/path/to/file
but these just don't seem to work.

Is there a way of doing this without mounting first?
 
Old 01-26-2006, 02:55 PM   #2
halvy
Member
 
Registered: Aug 2005
Location: Anchorage, Alaska (soon EU, hopefully)
Distribution: Anything NOT SystemD (ie. M$) related.
Posts: 918

Rep: Reputation: 42
well, can you explain this a little more please.

why do you want to do this.

what is your specs on your sys and os.

what kinda of error messages are you getting.

how 'far along' have you gotten (ie 'any success').
 
Old 01-27-2006, 03:51 AM   #3
humbletech99
Member
 
Registered: Jun 2005
Posts: 374

Original Poster
Rep: Reputation: 30
ok, in windows I can do Start --> Run (or in the explorer address bar) \\hostname\sharename and get straight to that machine's smb share and use it's file without having to first map the drive.

In linux (any they all work the same in bash) I want to be able to do the same thing but I doesn't look like I can, it seems to need you to mount the share somewhere on the filesystem before it can be used.

I have tried using the file a path like \\hostname\share\path\to\file as you can do in windows but this doesn't work.

I want to know if there is a nice easy way of doing this like in windows.

I've tried for example,

Code:
cat //hostname/c/autoexec.bat
cat: //hostname/c/autoexec.bat: No such file or directory
cat smb://hostname/c/autoexec.bat
cat: smb://hostname/c/autoexec.bat: No such file or directory
cat smbfs://hostname/c/autoexec.bat
cat: smbfs://hostname/c/autoexec.bat: No such file or directory
but none of them work although this path is definitely correct, there is a share called c (we created it to be called just c) and the file is there, I can do notepad \\hostname\c\autoexec.bat and it opens it.

The linux machine is capable of mounting smb shares fine though, it doesn't work on any machine.

Last edited by humbletech99; 01-27-2006 at 03:54 AM.
 
Old 01-27-2006, 06:16 AM   #4
halvy
Member
 
Registered: Aug 2005
Location: Anchorage, Alaska (soon EU, hopefully)
Distribution: Anything NOT SystemD (ie. M$) related.
Posts: 918

Rep: Reputation: 42
maybe set up the share in wine, no?
 
Old 01-30-2006, 02:59 AM   #5
humbletech99
Member
 
Registered: Jun 2005
Posts: 374

Original Poster
Rep: Reputation: 30
huh? I don't even have wine on these machines, they're all servers.

I can't put something like wine on them.

I'd really like to find a way to do this that is as clean as possible. I want to script the transfer of files to a share on an smb machine. I don't really wanna resort to the use of creating a temp mount point, mounting the share there and then unmounting it. There's also more that can go wrong when doing that.

Also, I don't see why this can't be done in Linux if it can be done in Windows (apart from the fact I'm not sure how to do it - somebody must know!).
 
Old 01-30-2006, 05:05 AM   #6
timmeke
Senior Member
 
Registered: Nov 2005
Location: Belgium
Distribution: Red Hat, Fedora
Posts: 1,515

Rep: Reputation: 61
What Windows does is exactly what you mention. It temporarily mounts the disk, accesses it and may -or may not- unmount it.
Just have a look at the "net use" command in Windows. That's what your explorer uses when you map a network drive and that's also used when you try to access a file without mapping the drive first.

Bottom line is, if you want to access a Samba disk that is shared by another computer, you'll need to mount it using smbmount first.

If you don't want to use Samba to access the (shared) files and folders, you can use alternatives like scp, sftp or plain ftp. But plenty can go wrong with that as well.
 
Old 01-30-2006, 06:11 AM   #7
humbletech99
Member
 
Registered: Jun 2005
Posts: 374

Original Poster
Rep: Reputation: 30
yeah, I thought that the windows might be doing this but it's annoying that there isn't a way of getting linux to do this automatically as well, short of writing a bash script to automount and unmount it
 
Old 01-30-2006, 06:23 AM   #8
timmeke
Senior Member
 
Registered: Nov 2005
Location: Belgium
Distribution: Red Hat, Fedora
Posts: 1,515

Rep: Reputation: 61
Actually, I think that's what Samba does for you. Unlike NFS, which continuously connects/polls the mounted disk (that's why your system halts/slows down whenever the machine that hosts an NFS shared disk is temporarily unavailable), samba mounts are only actually used when you access them, if I'm not mistaken.

So, just use "smbmount" or put the smbfs in /etc/fstab for automatic mounting.

Of course, you could write a script that:
mounts the disk, using smbmount
calls your program to use the files
unmounts the disk once more

Normally, mounting/umounting is done by root only. If you want to mount/umount as normal users, you should
make the programs (for samba, these are smbmount and smbmnt if I'm not mistaken) run as root via the setUID bit. Users will then be able to mount SMB partitions in directories that they have write permission on.
But, you should only consider this if you can really trust your users. Allowing them to mount just about everything is a security risk, of course.
See the man pages for "smbmount" and "smbmnt" for more info, perhaps.
 
Old 01-30-2006, 06:26 AM   #9
humbletech99
Member
 
Registered: Jun 2005
Posts: 374

Original Poster
Rep: Reputation: 30
not really ideal but if it's the only way...
 
Old 01-30-2006, 01:06 PM   #10
halvy
Member
 
Registered: Aug 2005
Location: Anchorage, Alaska (soon EU, hopefully)
Distribution: Anything NOT SystemD (ie. M$) related.
Posts: 918

Rep: Reputation: 42
Quote:
Originally Posted by humbletech99
..
Also, I don't see why this can't be done in Linux if it can be done in Windows (apart from the fact I'm not sure how to do it - somebody must know!).
this is why i suggested wine (it was a joke really

you seem to miss the point that linux 'just doesn't do things' like windows-- for a reason.. its called: SECURITY.. lol

like tim said i don't think setting up a mount in fstab is going to be that dificult.

but you may need to adjust your samba config file tooo... dunno, i'm not a sambo expert either

good luck.
 
Old 01-30-2006, 01:13 PM   #11
humbletech99
Member
 
Registered: Jun 2005
Posts: 374

Original Poster
Rep: Reputation: 30
ok, spare me the talk down, I'm a sysadmin with lots of hands on samba and all the rest, I just thought it would be nice to see if anyone knew that little bit more than me, I write scripts nearly every day so I know I can automate this without a sweat but I just would have liked to see if it could be done. nobody else seems to think so either, but then, that's the challenge. Maybe I'll write a script to emulate the functionality I want...
 
Old 01-30-2006, 01:40 PM   #12
halvy
Member
 
Registered: Aug 2005
Location: Anchorage, Alaska (soon EU, hopefully)
Distribution: Anything NOT SystemD (ie. M$) related.
Posts: 918

Rep: Reputation: 42
Quote:
Originally Posted by humbletech99
ok, spare me the talk down, I'm a sysadmin with lots of hands on samba and all the rest, I just thought it would be nice to see if anyone knew that little bit more than me, I write scripts nearly every day so I know I can automate this without a sweat but I just would have liked to see if it could be done. nobody else seems to think so either, but then, that's the challenge. Maybe I'll write a script to emulate the functionality I want...
i'm suprised with an attitude like that, that you get much help.

you need to loosen up man, where all in on this together.
 
Old 01-31-2006, 02:57 AM   #13
humbletech99
Member
 
Registered: Jun 2005
Posts: 374

Original Poster
Rep: Reputation: 30
ok, but I prefer to stick to the tech really. That's why I'm not a politician. ;-)
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Network file deployment. unreal128 Linux - Software 2 09-10-2005 03:58 PM
modify /etc/network file 08260068 Linux - Newbie 1 03-11-2005 04:47 PM
Need help for file sharing over network Joey2619 Slackware 5 04-08-2004 02:19 PM
Network file sharing APOLLO Linux - Newbie 3 03-20-2004 03:09 PM
network configuration file ganninu Debian 5 11-27-2003 03:55 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 01:34 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration