Permanently mount a Windows share in Linux
Posted on April 4, 2009
Sick of manually mounting a Windows share on Linux with "mount" for it to drop off randomly? Or not really knowing if it is mounted or not?
Then make a permanent mount in fstab.
First, check you have smbfs installed
apt-get install smbfs
Now, make a mount path
mkdir /mnt/YOUR_NEW_PATH
Now we will edit /etc/fstab. Add a new line like this
//WINDOW_SERVER/SHARE_NAME /mnt/YOUR_NEW_PATH credentials=/etc/samba/credentials 0 0
Save and exit!
Next we need to make the credentials file that will store the username and password
nano /etc/samba/credentials
Add two lines and save.
username=WINDOWS_USERNAME password=WINDOWS_PASSWORD
Now, set permissions on the file so that only root can see it
chmod 700 /etc/samba/credentials
Now, lets mount it.
mount -a
Mount doesn't usually return anything, so a quick df -h will show that your Windows share has been permanently mounted. Go on, reboot if you don't believe me!
Related posts:
- CIFS/SMBFS “mount error 13 = Permission denied”
Are you getting a rather generic "mount error 13 = Permission denied" when trying to... - Managing User Shares in Windows
So you've probably got a Users folder with directories in matching all your Windows users,... - NTLM Authentication (Active Directory) on Apache (Linux)
Here is a quick guide to enabling NTLM authentication for Apache 2. I generally use... - NFS mount point hung?
Has your NFS mount point hung and turned into a black hole swallowing every filesystem... - Setting up and using NFS on Ubuntu
Network File System, NFS, has been around since Noah first networked his ark. Setting up...