-   Slackware (
-   -   Mounting Windows network shares at boot time? (

lowpro2k3 05-14-2006 09:43 PM

Mounting Windows network shares at boot time?
I installed Slackware 10.2 on a spare computer, I'm looking for a way to automount my windows network shares when I boot my computer.

I tried adding an entry to /etc/fstab, but that didnt work and I dont even know if I'm going in the right direction with that. I can mount the shares manually using a mount command.

cs-cam 05-14-2006 10:12 PM

Mmm, adding Samba shares in fstab _does_ work, you're just obviously doing it wrong. Post your fstab so we can see where.

Old_Fogie 05-15-2006 01:51 AM

i'm not guru, i know enuff to get myself into trouble,


smbmount://ServerIPAddress/ShareName /DirectoryForServerToMountTo -o username=yourwindowsusername,pasword=yourwindowspassword
note that's all one line in console.

Woodsman 05-15-2006 04:53 PM

My Windows and Slack boxes are not always powered up concurrently. Therefore, rather than embed my share connections in fstab, I wrote a script to connect to those shares. If the Windows box is not ready then my bash script merely reports a screen message to that effect. Because the connections are established by a script, I can manually make those connections if I later concurrently power up both and want to share files.

I named my connection script netconnect and I store that script in /usr/local/sbin.

During booting I run the netconnect script from within /etc/rc.d/rc.local.

One nice aspect about mounting through a script is flexibility because I can add or create connection shares with minimal fuss. That is, within the script I use procedures/subroutines. All I need do is create the Windows share point and then add one line in my script to call the mounting subroutine. I never have to muck with fstab either.

Of course, I need to have the Samba service running before I run the script and when I run the script manually I need root privileges.

Old_Fogie 05-15-2006 08:08 PM

so is your script something like

text file named and made executable
and then with these contents in it

smbmount://ServerIPAddress/ShareName /DirectoryForServerToMountTo -o username=yourwindowsusername,pasword=yourwindowspassword

soulestream 05-16-2006 07:31 PM

I am assuming your are not mounting AD shares.


Woodsman 05-16-2006 09:14 PM


so is your script something like

text file named and made executable
and then with these contents in it
Minimally, yes, that is my script. However, my script is more complicated than that.

My primary box is multi-boot with Windows NT4 and Slackware. My second box is Slackware only. When I boot my primary box into Slackware, using fstab I automatically mount all of my Windows partitions, all of which are NT4 partitions. I mount those partitions read-only, but, I also have one read-write FAT32 partition for sharing and shuffling files. I had that box configured for multi-booting a long time before I obtained my second box.

For consistency, I use the same mount points for either Slackware OS. For example, if I boot my primary box into Slackware, then my NT4 data files partition, which is my E: partition when in Windows, is mounted at mount point /mnt/nt_e. My shared FAT32 partition, which is my O: partition in Windows, is mounted at /mnt/nt_o. I have many Windows partitions, but those two examples should provide the idea. When I want to mount those Windows partitions from within my second box, I use the same mount point names. That kind of consistency keeps me from getting confused.

Because my primary box is multi-boot, my second box does not necessarily "know" which OS that box might be running. And I cannot predict that either. Therefore, my connection script needs to figure whether Windows or Slackware is the OS on the primary box. I use different box names for Windows and Slackware. In my script I ping the box name to test which OS I booted into. You might need to update your /etc/hosts file to include the box names and IP addresses. I use static addresses.

I do not automatically run all of my networking services when in Windows because I don't tinker much these days with my two boxes. Most of the time I just boot into NT4 for surfing and email as well pounding away in Word 97. Therefore typically I have no need for localized networking most of the time. I'm stuck on dialup, so that too negates the need for continuous network services. When I find occasional spare time and want to play and learn then I manually start my Windows networking services with a script. Although I have 256MB in my primary box, which is more than enough for NT4 even if I were to run networking services continuously, I've been around personal computers for almost 25 years. Thus, I'm sort of a throwback to the days and philosophy when one did not run unnecessary services and programs. Old habits like that are challenging to break. :)

When I want to tinker and I forget to start my Windows networking services, my second box netconnect script provides me error messages on screen. I do the Homer Simpson "Doh!", quickly run my Windows script, run my netconnect script again, and then everything connects fine.

Automating all of this is always an ultimate goal, but because I already know that most of the time I am not networking both boxes, I prefer to simply run my scripts manually. That would change if I finally had access to a broadband connection for the web. Then I'd have to start some of the Windows network services all the time.

I haven't finished the netconnect script for when I boot my primary box into Slackware because I have not found the time to update that box to 10.2. I probably will not do that until this coming winter and then I'll update both boxes to Slackware 10.3/11.0. I want to update both boxes with the same version of KDE too. When I finally update my boxes I want my Slackware user scripts and rc.d scripts on both boxes to work the same and eventually I'll write some sort of automatic synchronizing script to perform that for me.

But for now my manual methods are okay because when I want to connect my second box to my primary box, the primary box usually is in Windows. When I am running Slackware on both boxes I connect using the Konqueror fish (ssh) protocol. That is sufficient for me when I want to sync or browse files and the like.

With that said and done, I am providing a link to a copy of the script at my web site. Feel free to modify as you see fit. Understand that this script is not finished and is a work in progress.


The script sources a colorization script: /etc/functions-colors

What I have done probably overkill is for many people, but in a tinkering environment the script provides a lot of flexibility.

All times are GMT -5. The time now is 06:02 PM.