How to mount a Windows ( = Samba) network share from Ubuntu linux automatically at boot?
December 19, 2007 by tibor
Assumed variables
Windows ( = Samba) network share’s server IP: 192.168.1.100
(FYI: you can use the server’s name instead of the IP address as long as you have internal name resolution within your network so that the server’s name can resolve to your server’s IP)
Share name on server: share
Name of the local folder that we mount the remote share under: joes_share
username to access the Windows (samba) share: joe
password to access the Windows (samba) share: pass
Steps:
1. Open a terminal session such as gnome-terminal
2. Type sudo mkdir /mnt/joes_share then push ENTER
#This will create a local folder called share under folder /mnt
3. Type sudo nano -w /etc/fstab
#This will open the file /etc/fstab in the nano command line text editor
4. Type //192.168.1.100/share /mnt/joes_share smbfs credentials=/etc/samba/cred-file,uid=userid,gid=users 0 0
#THE LINE ABOVE SHOULD BE ONE LINE ONLY IN FSTAB! This command will mount the windows server share called “share” (with server IP address 192.168.1.100) to your local folder /mnt/joes_share
5. Push CTRL+X and then push Y to save this file
6. Type sudo nano -w /etc/samba/cred-file then push the ENTER key
7. Type username=joe then push the ENTER key
8. Type password=pass then push CTRL+X and then push Y to save this file
9. To make sure that it works Type: sudo mount -a and push ENTER
Now you should be able to:
#1 See the content of your SHARE from your remote computer mounted locally under /mnt/joes_share
#2 Add, Delete and Create any files under /mnt/joes_share as a regular (non-root) user without having to use the sudo command all the time
#3 Have the share automatically mount at boot time from now on


