mounting samba share on server pc

Jordi Ferrando jferrando at netplc.com
Sun Jan 29 19:24:28 UTC 2006


Hi Dave,

I have created an script for my system that mounts samba filesystems at 
start-up,
/etc/init.d/mount_samba

/#!/bin/sh/
/#/
/# mount_samba - Mounts samba filesystems/
/#/
/# Written by Jordi Ferrando/
/# Debian.etch/
/# jferrando at netplc.com/

MOUNT="/bin/mount"
UMOUNT="/bin/umount"

*start()* *{*
   *echo* "Mouting samba filesystems..."
   $MOUNT -t smbfs //127.0.0.1/datos /home/jferrando/datos -o credentials=/etc/smbc.jordi,uid=1000,gid=1000,codepage=unicode,iocharset=utf8,unicode
   $MOUNT -t smbfs //127.0.0.1/datos1 /home/jferrando/datos1 -o credentials=/etc/smbc.jordi,uid=1000,gid=1000,codepage=unicode,iocharset=utf8,unicode
   $MOUNT -t smbfs //192.168.8.5/datos /home/jferrando/surera -o credentials=/etc/smbc.jordi,uid=1000,gid=1000,codepage=unicode,iocharset=utf8,unicode
   $MOUNT -t smbfs //127.0.0.1/datos /home/amarquez/datos -o credentials=/etc/smbc.angela,uid=1002,gid=1002,codepage=unicode,iocharset=utf8,unicode
   $MOUNT -t smbfs //192.168.8.5/datos /home/amarquez/surera -o credentials=/etc/smbc.amarquez.surera,uid=1002,gid=1002,codepage=unicode,iocharset=utf8,unicode

*   echo* "Samba client mount end"  
*}*

*stop()* *{*
   *echo* "stop ..."
   $UMOUNT -l /home/jferrando/datos
   $UMOUNT -l /home/jferrando/datos1
   $UMOUNT -l /home/jferrando/surera
   $UMOUNT -l /home/amarquez/datos
   $UMOUNT -l /home/amarquez/surera

*   echo* "Umounted samba filesystems"
*}*

*status()* *{*
*   echo* "Filesystems ..."
*   df*
*}*

*restart()* *{*
   *echo* "restart ..."
   stop
   start
*}*

*reload()* *{*
   *echo* "start ..."
   stop
   start
*}*

*force_reload()* *{*
   *echo* "force-reload ..."
   stop
   start
*}*

*case* $1* in* 
   start*)*
      start
      *;;*
   stop*)*
      stop
      *;;*
   status*)*
      status
*      ;;*
   restart*)*
      restart
*      ;;*
   reload*)*
      reload
*      ;;*	
   force-reload*)*
      force_reload
      *;;*	
   **)*
*      echo* "Usage: mount_samba {start|stop|restart|reload|force-reload|status}"
      /#echo "Usage: ${0##*/} {start|stop|restart|reload|status}"/
      *;;*
*esac*

*exit* 0

Then create an init link in /etc/rc2.d
$ ln -s ../init.d/mount_samba S99mount_samba

This will mount the file system after samba is started. It works fine 
for me.

dave s wrote:

>On Sunday 29 Jan 2006 18:43, Liz Young wrote:
>  
>
>>On Sunday 29 January 2006 05:31, dave s wrote:
>>    
>>
>>>When my machine boots it fails to mount the samba shares.
>>>      
>>>
>>If it's local, why not access the shares through the file system?
>>    
>>
>
>Never having used Samba before I was unsure if modifying files directly would 
>throw Sambas file locking off. Is this an issue or am i being paranoid ?
>
>  
>
>>Fstab is read before samba starts.  
>>    
>>
>
>Ahhh ... that might explain it
>
>  
>
>>You need a script to run your mount 
>>command sometime /after/ samba starts.
>>See #10.6 in http://www.debian.org/doc/FAQ/ch-customizing.en.html  for the
>>Debian way of doing that.
>>    
>>
>
>Thanks
>
>Dave
>  
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/kubuntu-users/attachments/20060129/a6dd057a/attachment.html>


More information about the kubuntu-users mailing list