Mount a Windows file share in Linux
Here are the basic steps to mount a Windows share under Linux:
- Create a file somewhere, perhaps in your home directory, to store the credentials. I called mine .smbcredentials
- Edit the new file and insert the following two lines:
username=MyUsername@MyDomain password=MyPassword
- Make root the file owner
sudo chown root .smbcredentials
- Allow root to read it
sudo chmod 600 .smbcredentials
- Create the mount point
sudo mkdir /mnt/backup
- Edit the mount config file
sudo vim /etc/fstab
- 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
- Reload fstab, at which point you should be able to list that mount directory.
sudo mount -a