What is the difference between the
cifs filesystem type?
The file system
smbfs is an older FS, originating form the Samba project, that was heavily coupled with the Samba tooling (smb.conf, smbmount, etc.). This filesystem has been deprecated though not yet removed for backward compatibility. However, users should now see warnings when using it (at least for the first mount use). There is no maintainer for the
The file system
cifs is the newer filesystem in the Kernel. It has improved support (like SMB2 though still experimental as of Kernel 3.8) and is properly maintained. It does not rely on Samba tooling (like smb.conf).
How to mount a Windows/Samba share as a local directory?
Here is what one need to do:
sudo apt-get install smbfs sudo mkdir /mnt/share sudo mount -t cifs //net-host/share /mnt/share -o user=huygens,domain=lan
The last command will request user huygens' password. Once successfull, this the SMB share folder is mapped to the directory /mnt/share. If one go exploring with Nautilus, one go to “File System” → “mnt” → “share” and then one can access and open all files.
However at next reboot, this mount point will have been forgotten and one will need to do the last three commands again.
One can make the configuration permanent by modifying the file that manage partitions and disks (/etc/fstab).
So edit this file as administrator and add the following line:
//net-host/share /mnt/share cifs credentials=/etc/smb-pw/net-host 0 0
A bit of explanation, the login and password are going to be place in a file that is private to the super user (not readable by others). Create the
/etc/smb-pw directory and make it readable only by root and the smb user (assumed to be root as well).
sudo mkdir /etc/smb-pw/ sudo chown root:root /etc/smb-pw/ sudo chmod 0710 /etc/smb-pw/
Now the file net-host (in /etc/smb-pw/) should have the following content:
Once the file is created and saved, lock it down so that only root can read it:
sudo chmod 0400 /etc/smb-pw/net-host
To simply test the mount:
sudo mount /mnt/share ls /mnt/share sudo umount /mnt/share
smbfs is pretty similar to
cifs though one should prefer/favour the use of the latter.
sudo apt-get install smbfs sudo mkdir /mnt/share sudo mount -t smbfs //net-host/share /mnt/share -o username="net-host\huygens"
The previous commands apply only to the current boot session. After a reboot this configuration is lost (just like
The same type of persistent configuration as
cifs can be done. Simply add this line to
//net-host/share /mnt/share smbfs credentials=/etc/smb-pw/net-host 0 0
You can use the same credentials format as for cifs but the user name should be in the form “hostname\username” or “workgroup\username” or “domain\username”, e.g.:
For the problem with the space in the shared folder name, one could use the double quote or backslash to circumvent it.
The code and explanation are similar to previous sections, so I will be brief in describing the following commands and edits.
sudo apt-get install smbfs sudo mkdir /mnt/share sudo mount -t cifs //net-host/Share\ Folder /mnt/share -o user=huygens,domain=lan
regarding editing the file /etc/fstab:
//net-host/Share\040Folder /mnt/share cifs credentials=/etc/smb-pw/net-host 0 0
A bit of explanation, the spaces in the share drives have to be replace by '\040'.