LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 07-07-2003, 10:33 PM   #1
rparkes
LQ Newbie
 
Registered: May 2003
Posts: 22

Rep: Reputation: 15
How to mount remote shares at boot up


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.

Am I missing something?
 
Old 07-07-2003, 11:28 PM   #2
mlp68
Member
 
Registered: Jun 2002
Location: NY
Distribution: Gentoo,RH
Posts: 333

Rep: Reputation: 40
That sounds odd. It's done with fstab alright. The startup scripts are aware if the network is up, and will leave net mounts alone until it is up.

Here's a (mangled, fictionalized the machine name) excerpt from one of my fstab's

Quote:
my.machine.net.atome:/export/data1 /export/data1 nfs rw,bg,wsize=32768,rsize=32768,nfsvers=3 0 0
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:

Quote:
//theshare.name.net/myarea /mnt/win/myarea smbfs username=myusername,uid=100,gid=100,user
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.

Hope it helps,

mlp
 
Old 07-09-2003, 09:01 AM   #3
rparkes
LQ Newbie
 
Registered: May 2003
Posts: 22

Original Poster
Rep: Reputation: 15
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.
 
Old 07-10-2003, 11:32 AM   #4
rparkes
LQ Newbie
 
Registered: May 2003
Posts: 22

Original Poster
Rep: Reputation: 15
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.
 
Old 07-12-2003, 12:13 PM   #5
jkcunningham
Member
 
Registered: May 2002
Location: Seattle, WA, USA
Distribution: Gentoo
Posts: 136

Rep: Reputation: 15
What distribution are you using? There are ways to control when network mounts occur in some distributions, but it depends on the distribution.
 
Old 07-13-2003, 09:58 AM   #6
rparkes
LQ Newbie
 
Registered: May 2003
Posts: 22

Original Poster
Rep: Reputation: 15
I'm using RH9. I problably got the incorrect syntax from a website somewhere.
 
Old 07-16-2003, 06:35 AM   #7
Poetics
Senior Member
 
Registered: Jun 2003
Location: California
Distribution: Slackware
Posts: 1,181

Rep: Reputation: 49
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?
 
Old 07-16-2003, 10:01 AM   #8
mlp68
Member
 
Registered: Jun 2002
Location: NY
Distribution: Gentoo,RH
Posts: 333

Rep: Reputation: 40
The entry I quoted above is almost right for that , try

[QUOTE]//theshare.name.net/myarea /mnt/win/myarea smbfs username=myusername,password=secret,uid=100,gid=100[ 0 0/QUOTE]

The downside is that your password is in that file as discussed above.
Change the uid/gid values to your actual values.

mlp
 
Old 07-16-2003, 05:13 PM   #9
Poetics
Senior Member
 
Registered: Jun 2003
Location: California
Distribution: Slackware
Posts: 1,181

Rep: Reputation: 49
Thank you; I'll try that when I get home from work.
 
Old 07-16-2003, 10:17 PM   #10
jkcunningham
Member
 
Registered: May 2002
Location: Seattle, WA, USA
Distribution: Gentoo
Posts: 136

Rep: Reputation: 15
[QUOTE]Originally posted by mlp68
The entry I quoted above is almost right for that , try

Quote:
//theshare.name.net/myarea /mnt/win/myarea smbfs username=myusername,password=secret,uid=100,gid=100[ 0 0/QUOTE]

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:

/etc/fstab (line)
//sharename/somepath/ /mnt/win/wimpy smbfs credentials=/home/sylvester/.credentials,uid=100,gid=100 0 0

Then the ~/.credentials file looks like this:
username=sylvester
workgroup=vietnam
password=secret

Works for me.
 
Old 07-17-2003, 02:48 AM   #11
Poetics
Senior Member
 
Registered: Jun 2003
Location: California
Distribution: Slackware
Posts: 1,181

Rep: Reputation: 49
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
mount smb shares at boot gvaught Debian 12 06-13-2005 11:34 AM
Accessing remote shares with encrypted Samba password at bootup CyberGuy Linux - Software 1 01-09-2005 05:23 PM
Linux can mount samba shares but not windows shares bindsocket Linux - Software 1 12-01-2003 05:28 PM
Remote Mounting? (Mount remote folder on local filesystem) mac_phil Linux - Networking 1 11-15-2003 03:48 PM
Auto Mount On Boot Win32 Shares zipur Linux - Networking 1 10-08-2002 02:38 AM

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

All times are GMT -5. The time now is 02:31 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