mount.cifs only works with sudo mount.cifs for user=somename

Asked by rickrack

I was testing ubuntu 12.04 workstation for my samba mounts. On 10.04 I am able to mount my users at any workstation using: mount.cifs //someserver/homes /media/mountpoint -o user=someuser,pass=someuserpassword
Now, this only works for different users only if i use
sudo mount.cifs //someserver/homes /media/mountpoint -o user=someuser,pass=someuserpassword

Is this a permanent change for 12.04 or is this a bug?
Is there a work around?
I need this without using sudo.

Question information

English Edit question
Ubuntu cifs-utils Edit question
No assignee Edit question
Last query:
Last reply:
Revision history for this message
actionparsnip (andrew-woodhead666) said :

If you add the line in /etc/fstab and grant the ability for users to mount and unmount it as they wish it will be ok. Add the noauto and noboot options so it isn't attempted to be mounted at bootup

Revision history for this message
rickrack (rick-giorgio) said :

Yes i tired that and it only works for the person who is logged into the workstation. Other users were not able to login to the share. It used to work that anyone could log into their home folder or shares without concern for the workstation's login.

Revision history for this message
rickrack (rick-giorgio) said :

The reason I need this to work with mounting folders for different users is that we are running a school and we may have hundreds of different logins. If we had to configure each workstation, it would be impossible to maintain. The students using version 10.04 can login at any workstation and work on their local mount using Samba. I hope version 12.04 does not change the way Samba works.

Revision history for this message
Andy Ruddock (andy-ruddock) said :

This one intrigued me, so I did a bit of hunting and found a few people on the 'net asking for non-root cifs mounting.
Essentially, for security reasons, you can't do it.
However, there is a reasonably straight-forward solution, albeit one that requires the use of sudo.

If you add the line
ALL ALL=NOPASSWD:/sbin/mount.cifs
to your sudoers file on each client machine then the students could use
sudo //smb/share /media/mount -o user=<username>,pass=<pasword>

So you still have to use sudo, but it doesn't require adding all users to a sudo group.

You could write a small shell script which would hide the use of sudo from the pupils, perhaps doing a few checks of the parameters before continuing the mount.

Probably not the answer you were looking for :(

Can you help with this problem?

Provide an answer of your own, or ask rickrack for more information if necessary.

To post a message you must log in.