Mounting samba shares from a unix client

Revision as of 21:09, 4 March 2006 by Rcsu (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Mounting samba shares from a unix client

Using a share from a samba server within a unix filesystem depends on a lot of single components. You need at least the smbfs (which is no longer maintained) or the modern cifs kernel modules. Although many documentation says to use the smbfs, it has many restrictions and the cifs should be favoured. That said, I'll describe only the cifs module in this document.

Since the cifs filesystem is included in the standard Linux kernel, it is simple to build either as module or built in. You need to load it prior to mount a share or let modprobe load it via modprobe.conf.

The basic mount command is mount -t cifs //<server>/<share> <mountpoint>. Each component needs its own attention.

The mount utility calls a mount helper, usually mount.cifs and that in turn calls the utility smbmount. The mount helper mount.cifs is the user space helper and needed to do the authentication.

To resolve the <server> to a ip address, you need either a DNS server which knows the ip address or your client needs the nss module wins. It is a shared library which must be in the path of your ldd. Usually under /usr/lib. You also have to add the wins option to hosts in your /etc/nsswitch.conf.

mountpoint must be a directory elsewhere in the filesystemm which must exist.

TODO: explain the options for mount -t cifs as described in man mount.cifs

TODO: explain the name resolution with

TODO: make a step by step list to solve most of the problems

If you want to automatically mount shares at user logon time the only way I found is doing it with the pam_mount module. It is the only way to do an authenticated mount without requiring the user to store the password in a file or entering it on a terminal.