Archive

CIFS

Setting up cifs client to talk to Windows 2000/XP/2003 machines.

Common Internet File System (CIFS) is the protocol that Microsoft are gradually replacing all SMB communications with. From http://de.samba.org/samba/ftp/docs/faq/Samba-meta-FAQ-3.html :

“If you consider CIFS as a backwardsly-compatible refinement of SMB that will work reasonably efficiently over the Internet you won’t be too far wrong.”

Note: All testing done using Debian unstable (Sid) with 2.6.2 kernel with option CONFIG_CIFS=y.

Head to http://cvs.samba.org/cgi-bin/cvsweb/samba/source/client/mount.cifs.c and grab the latest source (1.7 at time of writing). Compile the source into a binary and move it into /sbin

mega:~# gcc /home/rph/mount.cifs.c -o mount.cifs mega:~# mv mount.cifs /sbin

Create a folder where you intend to mount the share

mega:~# mkdir /mnt/krd

Now mount the windows share into that folder. mount will try to use mount.<file system> when mounting a block device. Moving mount.cifs into /sbin and using the -t cifs switch lets mount use the helper app to mount cifs shares, letting you use command below. This also lets you add entries into your fstab if you wish to have the shares mounted on boot.

mega:~# mount -t cifs //kingrichard/d /mnt/krd -o user=rph,password=yeahright

Just check the new fs is mounted ok.

mega:~# df -h Filesystem            Size  Used Avail Use% Mounted on /dev/hda3             5.9G  1.5G  4.1G  27% / tmpfs                 252M     0  252M   0% /dev/shm //kingrichard/d       115G   87G   28G  76% /mnt/krd

Adding an entry to the fstab:

//kingrichard/d  /mnt/krd  cifs  user=rph,password=yeahright,user,rw  0  0

Alternatively, you can specify credentials=<filename> where <filename> is a file with the following format, this allows you to properly secure the credentials so as not to leave your password in a shared file like /etc/fstab:

.nf         username=rph         password=yeahright .fi

For more options, see http://www.samba.org/samba/docs/man/mount.cifs.8.html

Leave a Reply