Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 136272 - shared user samba mounts not possible
Summary: shared user samba mounts not possible
Status: RESOLVED UPSTREAM
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Low minor (vote)
Assignee: Gentoo's SAMBA Team
URL: http://thread.gmane.org/gmane.network...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-06-10 03:51 UTC by Martin von Gagern
Modified: 2006-12-17 15:00 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin von Gagern 2006-06-10 03:51:27 UTC
Mounting windows shares as a normal user causes quite a lot of trouble for me.

I have this entry in my /etc/fstab:
> //workstation/share /mnt/mountpoint smbfs             \
> user,noauto,username=un,password=pwd,uid=un,gid=users,\
> fmask=660,dmask=770,codepage=850   0 0

With a root owned mount point I get this error message when I try to mount this using "mount /mnt/mountpoint":

> cannot mount on /mnt/mountpoint: Operation not permitted
> smbmnt failed: 1

After reading bug 72197 comment 4 I changed the ownership of the mountpoint to the user most likely to use this mount. This is already a degradation, because I would want every user allowed to mount that share at the same location, the way it works with other "user" mounts.

Now mount works, but umount causes me trouble:

> umount: only root can unmount //workstation/share from /mnt/mountpoint

Unlike bug 44743 comment 8 this is only for umount, smbumount works.

So overall as a workaround I can use smbmount and smbumount and have every user create a mount point owned by himself. But it would be great if SMB mounts could be handld just as any other mount specified in /etc/fstab. Especially as the smbmount manpage states that usually smbmount is invoked by mount, and using mount and smbumount is kind of asymmetric and unintuitive.

This is my samba version, with the configured USE flags:
net-fs/samba-3.0.22  +acl -async -automount +cups -doc -examples -kerberos -ldap -ldapsam -libclamav +mysql -oav +pam +postgres +python -quotas +readline (-selinux) -swat -syslog -winbind +xml +xml2

The permissions of the binaries look correct
(according to bug 2635 and bug 105680):
-rws--x--x 1 root root  91876 /bin/mount
-rws--x--x 1 root root  28844 /bin/umount
-rws--x--x 1 root root  10464 /usr/bin/smbmnt
-rwxr-xr-x 1 root root 773028 /usr/bin/smbmount
-rws--x--x 1 root root   7604 /usr/bin/smbumount

My kernel is 2.6.16-gentoo-r7 on i686

If you should consider this not a bug, then at least it is an RFE.
I marked it a bug because I expect consistent behaviour.
Comment 1 Martin von Gagern 2006-08-08 08:27:02 UTC
Ping?
Comment 2 SpanKY gentoo-dev 2006-12-17 12:42:34 UTC
this looks like it's currently by design:
/* Check whether user is allowed to mount on the specified mount point. If it's
   OK then we change into that directory - this prevents race conditions */
static int mount_ok(char *mount_point)
{
    struct stat st;

    if (chdir(mount_point) != 0) {
        return -1;
    }

        if (stat(".", &st) != 0) {
        return -1;
        }

        if (!S_ISDIR(st.st_mode)) {
                errno = ENOTDIR;
                return -1;
        }

        if ((getuid() != 0) && 
        ((getuid() != st.st_uid) || 
         ((st.st_mode & S_IRWXU) != S_IRWXU))) {
                errno = EPERM;
                return -1;
        }

        return 0;
}

as you can see, smbmnt.c will abort if the user attempting the mount does not actually own the directory
Comment 3 SpanKY gentoo-dev 2006-12-17 12:47:32 UTC
so really you should consult upstream:
https://lists.samba.org/mailman/listinfo/samba

please let us know how it goes !
Comment 4 Martin von Gagern 2006-12-17 15:00:08 UTC
(In reply to comment #3)
> so really you should consult upstream.
> please let us know how it goes !

Reported on the samba user list. Feel free to follow the thread:
http://thread.gmane.org/gmane.network.samba.general/85707

I'll come back here when something interesting turns up.