We have previously seen how to mount a hard disk automatically under Ubuntu. Today we will see another tutorial explaining how to make Ubuntu mount automatically a shared folder at system startup. The tutorial will be precisely about creating and mounting an smbfs share.
Install first the smbfs package under Ubuntu 11.10 or any older version of Ubuntu with this command:
sudo apt-get install smbfs
Create now the folder you want to share with other systems using this command:
sudo mkdir /media/myfolder
Note: Replace myfolder with any folder of your choice.
To make this folder mount automatically at Ubuntu startup, edit the /etc/fstab file with this command:
sudo gedit /etc/fstab
Then add the following line at the end:
//servername/myfolder /media/myfolder smbfs username=user,password=pass 0 0
Replace options marked in colors with your own details. If the share doesn't require a username and password, then replace them with this word: defaults.
Then press Ctrl+Q and save your file to exit. To verify if your share is well mounted, run this command from the terminal:
sudo mount -a
Your system will now mount the shared folder automatically without the need to mount it manually.