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.
I've got Samba shares and NFS shares on other machines on a home network that I would like to mount when booting Linux.
Several sites and books I've looked at have recommended placing entries in fstab to do this, and have shown the synax (e.g. Christopher Negus' Linux Bible). However, when I try to do this, I come up against the obvious problem that the network interface is not up at that point, and consequently, the shares aren't available. I posted this problem on a Samba newsgroup, and everyone suggested using automount instead.
But this still doesn't explain why I keep reading that it can be done via fstab. I know I could use the noauto option and mount them manually, but I believe this shouldn't be necessary.
Don't worry about the options. The important thing is "nfs", that tells that it is a network mount. The other parameters mean
rw = read/write,
bg = if for any reason the mount cannot be completed, background the mount process (recommended)
wsise,rsize = "block size" of writes, reads, I am reading big files, so larger means more efficient. You should leave that out first
nfsvers=3 use version 3 of nfs, kernel must support it, server must support it. Recommended.
You can do the same with samba mounts, EXCEPT for one quirk. Samab wants a password to mount, and you could put the password into the fstab file, open for prying eyes. There are more methods of autheticating to the samba server, which may or may not work. If no one else has access to the machine, it may be ok, but most likely it's not. You would have the same problem with automount, by the way.
I do it differently, I allow a "user mount" (the user being me) to mount a share on demand in teh session; here's from my desktop's fstab:
When I then mount /mnt/win/myarea, I'll be prompted for my samba passwd on the remote server. If you want to mount at startup, add password=... to the options. For the user option, you will need to add suid privileges to smbmount. It will tell you.
The UID and GID entries are convenient. The samba protocol doens't knwo about those, so you make the files *appear* to be owned by you with the uid/gid values (which should be yours).
Try a nfs thing first and see if that works. The progress to a samba entry in fstab.
Thanks - I have to confess that I hadn't investigated booting with NFS in detail - I thought it wouldn't work since Samba wouldn't work.
The Samba settings are similar to what I was trying, but even with the user, password, uid etc, it complained that the shares weren't available when booting.
I'm not sure from your posting whether you have to set up a user mount, or whether you should be able to automatically mount if the user details are provided.
Well, despite what I thought, it seems I can mount Samba shares using fstab. I don't know why this didn't work before - I think I was using different syntax, perhaps. Funny that no-one on the Samba mailing list set me straight on this issue.
I'm currently running a Slackware 8.1 server and a 9.0 desktop and am interested in doing quite a similar thing; I have a full-access share (via) samba on the server, open to the entire windows network. I would also like to mount this share (full read/write access) on the 9.0 box at bootup, as something akin to "/shares/files" or something.
For a "simple" share as described above, what would the entry in fstab be?
-or-
Should I put the mount command into a global login script?
The downside is that your password is in that file as discussed above.
Change the uid/gid values to your actual values.
mlp
You don't need to put your name and password in /etc/fstab where anyone can see it (even non-administrators on most systems). You can put it in a credentials file in your own directory and give that chmod 400 attributes so no one can see it. Here's what it looks like:
I know it's a bad security risk, but I'm running this server from behind several firewalls and it's just connected to two other computers (yay hosts.deny) and it's wide open to those two computers; anonymous wrx access. Hopefully I won't have to deal with users or anything
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.