Account Links: Cart | Your Account | Logout

Skip to content

Red Hat Knowledgebase

Red Hat Knowledgebase Search:

Updated Within the Last:

New Solutions within the last day New Solutions within the last week New Solutions within the last month

Browse by topics:


Click to View a Topic
General Linux > Samba > Issue <<  16 of 98 >>

Solution Tools:


Email a Solution Postcard Printer version Submit a comment on this answer Update notifications Request an answer Back

Article Reference

Article ID: 3420
Last update: 12-08-06
Issue:
How do I configure a system to automount a Samba share with /etc/fstab or autofs?
Resolution:
To enable a Samba share to be mounted when a machine boots edit the /etc/fstab file to include the following:

//server/share /mount/point smbfs username=[username],password=[password] 0 0

Where server is the Samba server name, share is the Samba share and /mount/point is the directoy on the local machine to mount to. The username and password options are of a valid user on the Samba server who has access to the Samba share you are trying to access.

Edit the /etc/fstab file

 
LABEL=/                 /                       ext3    defaults        1 1         
LABEL=/boot             /boot                   ext3    defaults        1 2
none                    /dev/pts                devpts  gid=5,mode=620  0 0
none                    /proc                   proc    defaults        0 0
none                    /dev/shm                tmpfs   defaults        0 0
/dev/hda3               swap                    swap    defaults        0 0
/dev/cdrom              /mnt/cdrom              udf,iso9660 noauto,owner,kudzu,ro 0 0
/dev/fd0                /mnt/floppy             auto    noauto,owner,kudzu 0 0
//server/share          /mount/point            smbfs   username=[username],password=[password] 0 0
     


Substitue [username] and [password] with the appropriate credentials of a valid user on the Samba server.

If you want to use the autofs service to mount SMB shares then follow the instructions below.

Edit the /etc/auto.master file

 
# $Id: auto.master,v 1.2 1997/10/06 21:52:03 hpa Exp $
# Sample auto.master file
# Format of this file:
# mountpoint map options
# For details of the format look at autofs(8).
/misc   /etc/auto.misc  --timeout=60
     


Edit the /etc/auto.misc file
  
# $Id: auto.misc,v 1.2 1997/10/06 21:52:04 hpa Exp $
# This is an automounter map and it has the following format
# key [ -mount-options-separated-by-comma ] location
# Details may be found in the autofs(5) manpage
                                                                                
cd              -fstype=iso9660,ro,nosuid,nodev :/dev/cdrom
                                                                                
samba           -fstype=smbfs,username=[username],password=[password] ://server/share
                                                                                
# the following entries are samples to pique your imagination
#linux          -ro,soft,intr           ftp.example.org:/pub/linux
#boot           -fstype=ext2            :/dev/hda1
#floppy         -fstype=auto            :/dev/fd0
#floppy         -fstype=ext2            :/dev/fd0
#e2floppy       -fstype=ext2            :/dev/fd0
#jaz            -fstype=ext2            :/dev/sdc1
#removable      -fstype=ext2            :/dev/hdd
     


Issue the command service autofs restart so that the new changes will take effect.

Browsing to the /misc/samba directory should reveal the Samba mount.


How well did this entry answer your question?


good wrong incomplete out of date
General Linux > Samba > Issue <<   16  of  98  >>