|
Ubuntu newb running 11.04. Seems like a lot of other people are having trouble mounting the network drive at boot in fstab. Tried a bunch of things and cruising the forums but just ended up being a mess. Finally got it going and I though I would share for others and if I need to do it again later. |
|
|
|
Also worth noting is that it is not very secure as the file you save the credentials in is in plain text, but I didn't care at this point. |
|
|
|
1. Install smbfs: |
|
sudo apt-get install smbfs |
|
|
|
2. Then create a folder inside of the /media directory to mount the share in: |
|
sudo mkdir /media/server |
|
|
|
3. Create a credentials file in /root so that you can save your password and have it protected by the root account: |
|
sudo gedit /root/.cifscredentials |
|
|
|
4. Add the following lines to the file and just replace the username/psswd with the ones you use to log into the share: |
|
username= your username |
|
password= your password |
|
|
|
Note: If your fileserver allows Guest access you can just leave the file as above. If it is password protected you have to put in your username and password. |
|
|
|
Save and close the .cifscredentials file. |
|
|
|
Note: Change the ownership and permissions for your credentials file so only root has access to it for additional security |
|
sudo chown root .cifscredentials |
|
sudo chmod 600 .cifscredentials |
|
|
|
5. Now open up your fstab file so that you can add mounting instructions (recommend backup first "sudo cp /etc/fstab /etc/fstab.bak): |
|
sudo gedit /etc/fstab |
|
|
|
Important note, for me this is slightly different in 11.04 as it required my UID which you can find by typing "id" at the prompt. Add this line to the bottom of the fstab file: |
|
|
|
5.1 Origional: |
|
//192.168.0.10/SHARENAME /media/Storage cifs auto,iocharset=utf8,uid=USER,gid=users,credentials=/root/.cifscredentials,file_mode=0775,dir_mode=0775 0 0 |
|
|
|
5.2 Mine: |
|
//10.0.0.2/server /media/server cifs auto,iocharset=utf8,uid=1000,gid=users,credentials=/root/.cifscredentials,file_mode=0775,dir_mode=0775 0 0 |
|
|
|
You have to change the following information: |
|
Change 192.168.0.10 to the IP address or DNS name of your server |
|
Change SHARENAME to the share you want to mount |
|
Change USER to your Ubuntu username |
|
|
|
The file_mode=0775,dir_mode=0775 part sets the mounted directory as read/write for all users so long as the SMB username you set in .cifscredentials has read/write access. |
|
|
|
6. Now save the file and run the following command to test to see if you mount now works: |
|
sudo mount -a |
|
|
|
If that worked you should see a new drive icon on your desktop that lets you access your share. Now try rebooting and see if your shares mount automatically. If everything went as planned you will have a nice little drive mounted on your desktop every time you start up. |