LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Debian (https://www.linuxquestions.org/questions/debian-26/)
-   -   mount smb shares at boot (https://www.linuxquestions.org/questions/debian-26/mount-smb-shares-at-boot-312122/)

gvaught 04-11-2005 03:11 PM

mount smb shares at boot
 
Hi all, again.

I've about read myself cross-eyed and I'm not making any progress. This may look like it's been asked/answered before, but I can't find it. If it has, please give me the link rather than go through the whole 'this is how you do it' explanation.

The reason I have this here is that I am using Deb and I believe the resolution to my challenge has something to do with the way Deb boots up.

What I want to do is mount three network shares, via Samba since I use these shares when I boot to Windows, also. I can su to root and mount them manually immediately after boot, but I'd like to not HAVE to do that. Part of why people stick with M$ products is there's just too much work being repeated when you have to reboot that Windows does automagically. I am pretty confident that this doesn't NEED to be this way, it's just a matter of identifying and editing the right configuration files or setting up a shell script that runs at boot. Either way would work for me in this instance, if I could just get it figured out.

Here's my deal, I have the following in a shell script:

Code:

#!/bin/bash
mount -t smb //srvr/pub /mnt/common -o username=me,password=myself
mount -t smb //srvr/weezer /mnt/home -o username=me,password=myself
mount -t smb //srvr/tunez /mnt/music -o username=me,password=myself
mount

When I su to root and run ./mnt.shares.sh I get the following;

Code:

workstation:~# ./mount.shares.sh
Password:
Anonymous login successful
4476: tree connect failed: ERRDOS - ERRnoaccess (Access denied.)
SMB connection failed
/dev/hda6 on / type reiserfs (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw)
/dev/hda1 on /boot type reiserfs (rw,notail)
/dev/hda2 on /tmp type reiserfs (rw)
/dev/hda3 on /var type reiserfs (rw)
/dev/hda5 on /root type reiserfs (rw)
/dev/hda7 on /usr type reiserfs (rw)
/dev/hda8 on /home type reiserfs (rw)
/dev/hdb1 on /opt type ext3 (rw)
usbfs on /proc/bus/usb type usbfs (rw)
/dev on /dev/.static/dev type unknown (rw,bind)
none on /dev type tmpfs (rw,size=10M,mode=0755)
//srvr/pub on /mnt/common type smbfs (rw)
//srvr/weezer on /mnt/home type smbfs (rw)

Maybe this is working correctly, after all I do get two of the three shares mounted. Maybe the problem is in my Samba configuration for the tunez share. Then again, maybe I'm stuck with having to mount these by hand everytime I reboot my system into Debian. Does anyone have any thoughts or suggestions?

help

acid_kewpie 04-11-2005 04:25 PM

you managed to read everything out there and not once did you read about /etc/fstab???

/etc/fstab:
Code:

//server/share    /mnt/share      smbfs    username=bob,password=secret
job done.

gvaught 04-11-2005 09:16 PM

Quote:

Originally posted by acid_kewpie
you managed to read everything out there and not once did you read about /etc/fstab???

/etc/fstab:
Code:

//server/share    /mnt/share      smbfs    username=bob,password=secret
job done.

Uh, don't recall saying I'd read "everything out there". Simply that I'd read enough that it was all bleeding together (messages and words).

In any event, I've tried the fstab route in the past and it flat hasn't cooperated. Could be an issue with my smb.conf or smbpasswd setups rather than my bootup stuff. I don't know. That's why I'm posting, and reading.

gvaught 04-11-2005 09:26 PM

Tried the syntax offered by acid_kewpie for fstab - I get the same results on boot as I was getting with my shell. Which shows me that I've got the syntax correct. But I still don't have the last mount occuring successfully. Am going to try shuffling the order of the lines in fstab to see if that matters. It's always been the same share that fails to mount, but I've always tried mounting them in the same order. We'll try this one again.

gvaught 04-11-2005 10:03 PM

Here is my fstab:

Code:

# /etc/fstab: static file system information.
#
# <file system> <mount point>  <type>  <options>      <dump>  <pass>
proc            /proc          proc    defaults        0      0
/dev/hda1      /boot          reiserfs notail        0      2
/dev/hda2      /tmp            reiserfs defaults      0      2
/dev/hda3      /var            reiserfs defaults      0      2
/dev/hda5      /root          reiserfs defaults      0      2
/dev/hda6      /              reiserfs defaults      0      1
/dev/hda7      /usr            reiserfs defaults      0      2
/dev/hda8      /home          reiserfs defaults      0      2
/dev/hda9      none            swap    sw              0      0
/dev/hdb1      /opt            ext3    defaults        0      2
/dev/hdc        /media/cdrom0  iso9660 ro,user,noauto  0      0
/dev/hdd        /media/cdrom1  iso9660 ro,user,noauto  0      0
/dev/fd0        /media/floppy0  auto    rw,user,noauto  0      0
//srvr/tunez  /mnt/music      smbfs  username=me,password=myself
//srvr/pub    /mnt/common    smbfs  username=me,password=myself
//srvr/weezer    /mnt/home      smbfs  username=me,password=myself
//srvr/www    /mnt/web        smbfs  username=me,passwrod=myself

And here is the result of mount immediately after boot:

Code:

$ mount
/dev/hda6 on / type reiserfs (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw)
/dev/hda1 on /boot type reiserfs (rw,notail)
/dev/hda2 on /tmp type reiserfs (rw)
/dev/hda3 on /var type reiserfs (rw)
/dev/hda5 on /root type reiserfs (rw)
/dev/hda7 on /usr type reiserfs (rw)
/dev/hda8 on /home type reiserfs (rw)
/dev/hdb1 on /opt type ext3 (rw)
usbfs on /proc/bus/usb type usbfs (rw)
/dev on /dev/.static/dev type unknown (rw,bind)
none on /dev type tmpfs (rw,size=10M,mode=0755)
//srvr/pub on /mnt/common type smbfs (rw)
//srvr/weezer on /mnt/home type smbfs (rw)

So, it's not necessarily the location/position of the share being mounted - it's got to be something with the share and it's setup in smb.conf:
Code:

# Samba config file created using SWAT
# from 10.10.1.1 (10.10.1.1)
# Date: 2005/04/11 22:50:01

# Global parameters
[global]
        workgroup = ITS.LOCAL
        server string = %h server (Samba %v)
        obey pam restrictions = Yes
        passdb backend = tdbsam, guest
        passwd program = /usr/bin/passwd %u
        passwd chat = *Enter\snew\sUNIX\spassword:* %n\n *Retype\snew\sUNIX\spassword:* %n\n .
        syslog = 0
        log file = /var/log/samba/log.%m
        max log size = 1000
        domain logons = Yes
        dns proxy = No
        wins support = Yes
        panic action = /usr/share/samba/panic-action %d
        invalid users = root
        valid users = weezer, chick
        admin users = weezer, root
        hosts allow = 10., 127.

[printers]
        comment = All Printers
        path = /tmp
        create mask = 0700
        printable = Yes
        browseable = No

[print$]
        comment = Printer Drivers
        path = /var/lib/samba/printers
        invalid users =
        guest ok = Yes

[homes]
        comment = Personal files stored on the network
        path = /home/%u
        invalid users =
        valid users = %S
        read only = No
        browseable = No

[pub]
        comment = Shared or public files stored on the network
        path = /home/common
        invalid users =
        read only = No

[www]
        comment = Website deployment space
        path = /home/www
        invalid users =
        read only = No

[tunez]
        comment = Music files in various formats
        path = /home/tunez
        invalid users =
        read only = No

Any suggestions or ideas would be greatly appreciated. And for the record, I've read A LOT, but not everything there is to be read. And I'm sure there are approaches that would probably yield the results I'm looking for, but I haven't thought of them, nor had them suggested, as yet.

gvaught 04-12-2005 03:05 PM

Okay, now I'm getting somewhat frustrated. I've got two shares mounting at boot. And I have two that don't mount, for no apparent reason that I can find. Also, the two shares that are mounted are supposed to be read-write, but I can't save a file to them. I have a file I've generated in Linux that I need to transfer to Windows, which is the biggest use I get from having a Samba files server. But, when I go to save it to /mnt/common, it chokes and gives me "Error saving the document myDoc.sxw: /mnt/home/My Documents/myDoc.sxw does not exist.". Well of course it doesn't exist there, that's why I'm trying to save it there!

Anyway, if anyone has any suggestions and can get past my grumpiness, I'd love to hear from you.

:mad:

ensnaregod 04-14-2005 04:45 PM

the fstab somewhat works for me but I don't have a password set for one of my shares that I want to connect to, what can I do besides add a password, so i can mount this share on boot

ensnaregod 04-14-2005 04:52 PM

also I can use with no problem

mount -t smbfs //computer/share /directory/ -o username=guest,password=""

my fstab is this

//computer/share /directory smbfs ro 0 0 username=guest,password=""

I also tried single quotes for the password also.... any ideas?

zuralin 04-14-2005 04:55 PM

//computer/share /directory smbfs ro 0 0 username=guest,password=""

should be:

//computer/share /directory smbfs ro,username=guest,password="" 0 0

ensnaregod 04-14-2005 07:07 PM

thanks I alway get stuck on syntax thanks again

slyguyr3 06-05-2005 12:57 PM

what is the significance of the ro after smbfs?

ensnaregod 06-13-2005 11:33 AM

ro = read only

ensnaregod 06-13-2005 11:34 AM

rw = read write


All times are GMT -5. The time now is 10:04 PM.