uid,gid,forceuid,forcegid seem to be ignored in smbmount on oneiric 11.10 beta2

Bug #859259 reported by Chris Moore
50
This bug affects 9 people
Affects Status Importance Assigned to Milestone
cifs-utils (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

I recently upgraded from 11.04 to 11.10 beta 2.

I've been using smbmount to connect to a samba share on another ubuntu machine for years, but since upgrading it has stopped working properly.

The command I've used successfully in the past is:

sudo smbmount //server/bigdrive ~/big -o user=deb,passwd=mypass,uid=chris,gid=chris,iocharset=utf8

That always used to make the files show up as user chris, group chris, and so I could edit them locally. In 11.10 however, that same command makes everything appear to be user root, group root. Even if I add 'forceuid' and 'forcegid' options, they still show up as root:root. If I add the 'noperm' mount option too, the files still show up as root:root, but then I can edit them. However, I'm still unable to delete files from directories with the 't' bit set, whereas previously I was able to delete such files. Here's an example. The folder has the 't' bit set. File 'x' doesn't exist. I can create it, but not delete it, unless I use 'sudo' to do so.

chris@chris:~/big$ ls -ld .
drwxrwxrwt 32 root root 0 2011-09-25 16:03 .
chris@chris:~/big$ ls -l x
ls: cannot access x: No such file or directory
chris@chris:~/big$ touch x
chris@chris:~/big$ ls -l x
-rw-r--r-- 1 root root 0 2011-09-25 16:03 x
chris@chris:~/big$ /bin/rm x
/bin/rm: cannot remove `x': Operation not permitted
chris@chris:~/big$ sudo /bin/rm x
chris@chris:~/big$ ls -l x
ls: cannot access x: No such file or directory
chris@chris:~/big$

I mounted the share using:

sudo smbmount //server/bigdrive ~/big -o noperm,user=deb,passwd=mypass,uid=chris,forceuid,gid=chris,forcegid,iocharset=utf8

Here are the versions:

chris@chris:~/big$ lsb_release -rd
Description: Ubuntu oneiric (development branch)
Release: 11.10
chris@chris:~/big$ apt-cache policy cifs-utils
cifs-utils:
  Installed: 2:5.0-1ubuntu1
  Candidate: 2:5.0-1ubuntu1
  Version table:
 *** 2:5.0-1ubuntu1 0
        500 http://ubuntu.osuosl.org/ubuntu/ oneiric/main i386 Packages
        100 /var/lib/dpkg/status
chris@chris:~/big$

Chris Moore (dooglus)
summary: - uid,gid,forceuid,forcegid seem to be ignored
+ uid,gid,forceuid,forcegid seem to be ignored in smbmount on oneiric
+ 11.10 beta2
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in cifs-utils (Ubuntu):
status: New → Confirmed
Revision history for this message
Robert Hutton (rwh-helms-deep) wrote :

I'm also affected by this. I upgraded from 11.04 to 11.10 today, and now my cifs mounts ignore the uid and gid the same as the OP.

An example of an fstab entry that I used with success before the upgrade and didn't work afterwards:

//fs1/Temp /media/temp cifs noauto,rw,user,user=mydomain/rwh,uid=rwh,gid=rwh 0 0

I get the same result if I mount shares manually using the mount.cifs command. e.g.:

mount.cifs //fs1/Temp /media/temp -o user=mydomain/rwh,uid=rwh,gid=rwh

ls -ld temp
drwxrws--x 14 root root 0 2011-08-05 10:00 temp

The same thing happens if I use numeric uid/gid.

Revision history for this message
Robert Hutton (rwh-helms-deep) wrote :

Interestingly, I've noticed a difference between using mount.cifs setuid root (invoked as a normal user) and actually running mount.cifs as root, using sudo:

mount.cifs --verbose -o rw,user=<domain>/rwh,uid=1000,gid=1000 //<fileserver>/<share>/<directory> /media/<share>
Password:
mount.cifs kernel mount options: ip=<myip>,unc=\\<fileserver>\<share>,noauto,uid=0,gid=0,ver=1,user=rwh,domain=<domain>,prefixpath=<directory>,pass=********

sudo mount.cifs --verbose -o rw,user=<domain>/rwh,uid=1000,gid=1000 //<fileserver>/<share>/<directory> /media/<share>
Password:
mount.cifs kernel mount options: ip=<myip>,unc=\\<fileserver>\<share>,uid=1000,gid=1000,ver=1,user=rwh,domain=<domain>,prefixpath=<directory>,pass=********

Note the difference between the reported uid and gid values. Perhaps this is a change in the way the kernel module behaves given a setuid root mount.cifs?

Revision history for this message
Erik Miranda (erikmiranda) wrote :

Supposing abc is a user on my system, when I set uid=abc,gid=abc, the share is mounted as root:root. However, I've noticed that if I set only gid or uid (but not both) to abc, then the permissions are applied except on the opposite field: gid seems to be assigning the user and uid seems to be assigning the group.

Revision history for this message
dvo (mueller8) wrote :

Erik, very interesting observation.

Apart from the nice workaround implied by this,
I can only say: Oh my goodness, Ubuntu Linux, where have you gone?

Since switching to 11.04, I've been experiencing all kinds of strange regressions like this and immature stuff like the unity UI.
I'm very close to switching to a Mac.

Revision history for this message
MarcS (marc-schmitzer) wrote :

I think I've hit the same bug.
I changed the line in fstab from using symbolic user and group id to numeric ones as a workaround.

Revision history for this message
Rob (0hnohh065) wrote :

Over 2 yrs later and this bug is still present in precise 12.04.3 LTS?? WTF. MarcS's workaround of changing from symbolic uid and gid to numeric worked for me as well.

Old /etc/fstab line
//server/share /win/server/share cifs rw,user,uid=john,gid=john,forceuid,forcegid,noexec,credentials=/home/john/share.txt 0 0

New /etc/fstab line
//server/share /win/server/share cifs rw,user,uid=1000,gid=1000,forceuid,forcegid,noexec,credentials=/home/john/share.txt 0 0

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.