Mounting a Windows Share

It is quite straight forward to mount a Windows share using the -t cifs option with the mount command, e.g.

 mount -t cifs -o username=myuser //WINDOWS_SHARE_IPADRESS/the_share_name /mnt
 

You will be prompted for the password asscociated with the user you specified.

If you want to mount a Windows share on boot, you will need to add it to /etc/fstab . It is obviously prefereable not to hard code passwords in a world readable file so here's a way around this. The following is an example line you would add to /etc/fstab:

 //mywindowsserver/theshare             /the_mount_point         cifs    credentials=/etc/samba/auth.priv,rw,uid=root 0 0
 

/etc/samba/auth.priv contains:

 username=the_user_name
 password=secretpassword
 domain=justsomestuff.co.uk

This file has the permissions

 ls -l /etc/samba/auth.priv
 -rwxr----- 1 root root 63 Nov  4 09:37 /etc/samba/auth.priv

This keeps the user credentials relatively safe.

Recent Changes

Contribute to this wiki

Why not help others by sharing your knowledge? Contribute something to this wiki and join out hall of fame!
Contact us for a user name and password