Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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.
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!).
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.
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
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.
Distribution: Anything NOT SystemD (ie. M$) related.
Posts: 918
Rep:
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
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...
Distribution: Anything NOT SystemD (ie. M$) related.
Posts: 918
Rep:
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.