Mounting and unmounting Samba shares over CIFS

CIFS is apparently better than SMBFS for mounting shares across a network in Ubuntu.  To set up fstab to automatically mount a share (with read/write access):

  1. apt-get install smbfs
  2. Create a file called .smbcredentials in the /root folder containing the lines:
    username=[your username]
    password=[your password]

    Then chmod 700 that file so that only root can access it.

  3. For each share, add the line:
    //Server/Sharename  /[local mountpoint]  cifs  credentials=/root/.smbcredentials,iocharset=utf8,file_mode=0777,dir_mode=0777  0  0

Done.  However, to make sure you don’t get the CIFS VFS: Server not responding error, execute:
ln -s /etc/init.d/umountnfs.sh /etc/rc0.d/K15umountnfs.sh
ln -s /etc/init.d/umountnfs.sh /etc/rc6.d/K15umountnfs.sh

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s