Koozali.org: home of the SME Server

Mounting samba shares on boot

Chris B

Mounting samba shares on boot
« on: November 18, 2003, 05:19:57 PM »
Mounting samba shares using the mount command works correctly but trying to do this automatically at boot time has not worked.

The currently working mount command on its own is:

mount -t smbfs //compname/share /folder/share -o username=username,password=password,dmask=0777,fmask=0777

I tried editing the fstab entry as follows:

//compname/share /folder/share smbfs credentials=/root/cred.file 0 0

cred.file holds the user credentials in the following format:

username=username
password=password
dmask=0777
fmask=0777

Any help would be most appreciated as I'm stumped!

Bob King

Re: Mounting samba shares on boot
« Reply #1 on: November 20, 2003, 07:42:10 AM »
You can setup permanent shares in smb.conf. The best way to do that is with a custom template fragment.

mkdir -p /etc/e-smith/templates-custom/etc/smbconf

Put the template fragment in that directory. The one I am using sets up a samba share for the Hylafax receive directory. The fragment is called 50recvq and contains the following:

****************************************************
{
# This makes a recvq share which fax viewers on
# Windows clients can access
}
[recvq]
comment = Fax receive Queues
path = /var/spool/hylafax/recvq
public = yes
writable = no
****************************************************

Setting up the share this way ensures that the share is available without any action on the part of an administrator and also survives system updates.

Hope this helps you.

Bob

Chris B

Re: Mounting samba shares on boot
« Reply #2 on: November 24, 2003, 04:51:39 PM »
Will this work if the share originates from a windows machine?  I have a share currently setup on a windows machine and I want to have a share setup on e-smith that points to this windows share.

Thanks.

Bob King

Re: Mounting samba shares on boot
« Reply #3 on: November 25, 2003, 03:06:01 PM »
To establish the permanent samba share link as described in my earlier post. Remember to change the file to suit you configuration and change writable to 'yes'.

You will also need to map the windows share to a mount point

cd mnt
mkdir test
mount -t smbfs -o password=password,dmask=0777,fmask=0777 //computer-name/share /mnt/test/

Now the windows share is mapped to /mnt/test and the share shows up in network neighborhood on windows machines.  

If you make the entries in the fstab file as follows:

//computer-name/share /mnt/test smbfs password=password 0 0

you will still need to enter the 'mount test' command, but you should be able to do that with a simple script.

Bob King

Re: Mounting samba shares on boot
« Reply #4 on: November 26, 2003, 02:38:44 AM »
I forgot to add that if you want a script to run at every boot-up - just drop the script in /etc/e-smith/events/local