Debian Squeeze: mount windows share using CIFS

Sunday, 12 December 2010 14:24 by myro

To mount a remote share In Debian Squeeze, make sure that cifs-utils is installed, otherwise you would receive the following error:

 mount: wrong fs type, bad option, bad superblock on //x.x.x.x/share

 to install cifs-utilis, just use apt-get:  apt-get install cifs-utilis.

Now you can mount the share on your local filesystem:
mkdir -p /mnt/yourShare
mount -t cifs //x.x.x.x/share/ -o username=username,password=password /mnt/yourShare 
-o iocharset=utf8,file_mode=0777,dir_mode=0777

If you want to mount this share automatically when your system loads, just add this line to your /etc/fstab file:

//x.x.x.x/share/mnt/yourShare   cifs  credentials=/root/.credentials,iocharset=utf8,file_mode=0777,dir_mode=0777 0 0

As you can see, I'm not writing the credentials directly in fstab file because this file can be viewed by anyone. To store your credentials in /root/.credentials, do:

sudo nano  /root/.credentials

and add the followin text:

username=your_smb_username
password=your_smb_password

 

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Tags:  
Categories:   Linux
Actions:   Bookmark and Share | Permalink | Comments (0) | Comment RSSRSS comment feed
If you consider this post usefull for your purposes, please consider visiting my sponsors to help me out with the myrocode.com maintenance. Thank you.