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

Asked by rickrack on 2012-07-16

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.
Thanks

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu cifs-utils Edit question
Assignee:
No assignee Edit question
Last query:
2012-07-17
Last reply:
2012-08-01

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

rickrack (rick-giorgio) said : #2

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.

rickrack (rick-giorgio) said : #3

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.

Andy Ruddock (andy-ruddock) said : #4

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.