How to: easy use samba mounts

From EasyPeasy Wiki

Jump to: navigation, search

If you are using an application which does not know what samba is(amaroK,Exaile) then this 'How to' is for you.

1. step

Open Synaptic and install smbnetfs package.

2. step

Make a directory where your smbnetfs will be attached:

$ sudo mkdir /media/smb
[sudo] password for ...

3. step

Write a new script to load at boot time. Edit file /etc/init.d/mountsmbfs.sh:

#! /bin/sh
PATH=/sbin:/bin
. /lib/init/vars.sh

. /lib/lsb/init-functions
. /lib/init/mount-functions.sh

if [ -r /etc/default/locale ]; then
        . /etc/default/locale
        export LANG
fi

do_start() {
        #
        # Mounts smbnetfs.
        #
        smbnetfs -o allow_other /media/smb
}

case "$1" in
  start|"")
        do_start
        ;;
  restart|reload|force-reload)
        echo "Error: argument '$1' not supported" >&2
        exit 3
        ;;
  stop)
        # No-op
        ;;
  *)
        echo "Usage: mountsmbfs.sh [start|stop]" >&2
        exit 3
        ;;
  *)
        echo "Usage: mountsmbfs.sh [start|stop]" >&2
        exit 3
        ;;
esac


4. step

Enable auto start:

$ sudo update-rc.d mountsmbfs.sh start 46 S .
 Adding system startup for /etc/init.d/mountsmbfs.sh ...
   /etc/rcS.d/S46mountsmbfs.sh -> ../init.d/mountsmbfs.sh

5. step

Copy some files to root's home directory.

$ sudo su
# cd
# mkdir .smb
# cd .smb
# cp /etc/smbnetfs.conf .
# cp /etc/samba/smb.conf

6. step

Reboot.

This file system is much better than smbfs because it mounts entire samba network not just a share. Because right after boot wireless network access is not available,you cannot see any directory on mount point /media/smb/ . If you have permament ip of network share, you can access this computer by adding ip. For example ip of computer is 192.168.0.3: The computer shared folders can be seen on /media/smb/192.168.0.3/

Nautilus does not support such invisible folders.

You can add media share in Exiale:

Edit->Library Manager->Add

Go to /media/smb

Press Ctrl-C

Input ip of the computer. In our example is /media/smb/192.168.0.3/

It must be slash at the end.

Press Enter

Feel free to correct this How to or to change the whole idea to better.

Personal tools