Mount a Windows file share in Linux

Here are the basic steps to mount a Windows share under Linux:

  1. Create a file somewhere, perhaps in your home directory, to store the credentials. I called mine .smbcredentials
  2. Edit the new file and insert the following two lines:
  3. Make root the file owner
          sudo chown root .smbcredentials
  4. Allow root to read it
          sudo chmod 600 .smbcredentials
  5. Create the mount point
           sudo mkdir /mnt/backup
  6. Edit the mount config file
          sudo vim /etc/fstab
  7. Add the following line, replacing backup with your mount dir, //offilefiles/backup with your share, just like in Windows but with forward slashes, and credentials with your file location.:
             //officefiles/backup /mnt/backup smbfs credentials=/home/chase/.smbcredentials,uid=1000 0 0
  8. Reload fstab, at which point you should be able to list that mount directory.
          sudo mount -a
Note: you may need to install samba first, with an apt-get install smbclient