How can automatically mount a samba share without having to type the password every reboot ?

Asked by Wladston Viana

I have followed the guide to permanently mount an authenticated samba share on the system, as it says here : http://doc.gwos.org/index.php/HowToMountsmbfsSharesPermanently

I have created the .smbcredentials, setup /etc/fstab, and rebooted. But then, the share isn't automatically mounted. If I go to computer:/// on nautilus, I see the share. If I double click on it, it says "Access to this internal disk it is restricted to system administrators for security reasons. Please enter your password to proceed"

If the correct password is entered, the share is mounted, but when it reboots, the share isn't mounted....

On the windows boxes, it works as expected.

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
Matt Mossholder
Solved:
Last query:
Last reply:
Revision history for this message
Matt Mossholder (matt-mossholder) said :
#1

Please post the folowing to assist in troubleshooting:

1) The line from your /etc/fstab showing the mount,
2) the output of 'ls -l .smbcredentials'
3) Any mount related log entries in /var/log/syslog

The error message you are seeing from Nautilus "Access to this internal disk..." is because Nautilus sees that the share isn't mounted, and as a non-root user, cannot mount it itself. It is asking for your local password so it can gain root privileges to perform the mount.

Revision history for this message
Wladston Viana (wladston) said :
#2

1)
//jangada/media /media/media smbfs credentials=~/.smbcredentials,dmask=777,fmask=777 0 0

2) I've set 777 and changed the owner in hope it would help
-rwxrwxrwx 1 wladston wladston 34 2007-06-11 01:59 .smbcredentials

3)
root@wlad-desktop:/home/wladston# cat /var/log/syslog | grep media
Jun 11 02:28:48 wlad-desktop hald: unmounted /dev/sdb5 from '/media/MEDIA' on behalf of uid 0

Maybe it's important to say that I HAD /dev/sda5 mounted in /media/media, but I've comented it ...
### /dev/sda5
###UUID=4508-8BC9 /media/media vfat defaults,utf8,umask=007,gid=46 0 1

Revision history for this message
Best Matt Mossholder (matt-mossholder) said :
#3

The first issue I see is that you cannot specify the credentials file using a "~", you must specify the full path. you probably also want to modify the fstab entry to specify your uid as the owner, otherwise root will own all the files. Try something more like this:

//jangada/media /media/media smbfs credentials=/home/wladston/.smbcredentials,dmask=777,fmask=777,uid=wladston 0 0

If that continues to have problems, you might want to try chowning the creds file to be owned by root, and changing the permissions so that only root can read/write the file, as such:

chown root.root .smbcredentials
chmod go-a .smbcredentials

Revision history for this message
Wladston Viana (wladston) said :
#4

Thanks Matt, that worked pretty well for me.

Now, there is one thing ... is it possible to do this by gnome ? because if not, maybe I should fill a bug, since this is a pretty common task that should be easy to reach for the end user.

Revision history for this message
Wladston Viana (wladston) said :
#5

Thanks Matt Mossholder, that solved my question.