Mounting a Samba Share

I just had to do this so I figured I’d pass along the hint.

If you have a windows computer on the same network as your Linux computer, you can access the windows files as if they were built into your Linux computer’s file system. For the quick and easy way, use this code:

mount -t smbfs -o username=myname,password=12345 //windows/filefolder /mnt/windowsfiles

The above code works every time you type it, but to make it mount at boot you’ll need to edit your fstab file.

Edit /etc/fstab with vi,vim,nano,kwrite or whatever you use to edit files (just make sure you have root privileges while editing it). Add this line:

//windows/filefolder         /mnt/windowsfiles         smbfs     credentials=/home/myname/.smbcredentials,rw     0 0

Then create that credentials file by type this:

echo username=myname > /home/myname/.smbcredentials
echo password=mypassword >> /home/myname/.smbcredentials

Then to mount all file systems listed in /etc/fstab:

mount -a

You should never have to think about that again. Hopefully.

Leave a Reply »»