[Samba] setuids mount option broke
dereks at realloc.net
Fri May 28 14:12:59 MDT 2010
I'm trying to export a /home/ partition for multiple users, using
Samba and the setuids option. My goal is to deliver emails into
$HOME/.Maildir/ for each user. So I mount the share as user "root",
hoping that each user will be able to use their own home directory (just
like an NFS /home/ mount). (This feature depends on the Unix extensions.)
I have the following share configured in smb.conf:
comment = Root-mounted Home Dir
browseable = no
writable = yes
valid user = root
path = /home
I can mount it using these options in /etc/fstab... note the use of
//cst6/testhome /testhome cifs
iocharset=utf8,credentials=/root/cst6_password.txt,setuids 0 0
But setuids seems to be broken, either in the server, or in the
client, or both.
With an Ubuntu 9.10 or 10.4 client (Samba 3.4.0 or 3.4.7), it's
completely broke. If I try to create a file as a regular user, it does
create the file (as root) but then fails when it goes to set the
ownership. Note the "Permission denied" error below, after the file was
root at cst5:/testhome# mkdir test
root at cst5:/testhome# chmod 777 test
root at cst5:/testhome# su - ubuntu
ubuntu at cst5:~$ cd /testhome/test/
ubuntu at cst5:/testhome/test$ touch file_test1.txt
touch: cannot touch `file_test1.txt': Permission denied
ubuntu at cst5:/testhome/test$ mkdir dir_test1.d
ubuntu at cst5:/testhome/test$ ls -la
drwxrwxrwx 3 root root 0 2010-05-28 12:58 .
drwxr-xr-x 7 root root 0 2010-05-28 12:57 ..
drwxr-xr-x 2 root root 0 2010-05-28 12:58 dir_test1.d
-rw-r--r-- 1 root root 0 2010-05-28 12:58 file_test1.txt
ubuntu at cst5:/testhome/test$
The "Permission denied" error indicates that it is trying to set the
UID, but failing.
But using an ebox client (Samba 3.4.5), it *almost* works.
Newly-created files have the correct UID, but new directories are still
owned by root (with no error message printed):
root at ebox:/testhome# mkdir test
root at ebox:/testhome# chmod 777 test
root at ebox:/testhome# su - ubuntu
ubuntu at ebox:~$ cd /testhome/test
ubuntu at ebox:/testhome/test$ touch file_test1.txt
ubuntu at ebox:/testhome/test$ mkdir dir_test1.d
ubuntu at ebox:/testhome/test$ ls -la
drwxrwxrwx 3 root root 0 2010-05-28 12:51 .
drwxr-xr-x 7 root root 0 2010-05-28 12:50 ..
drwxr-xr-x 2 root root 0 2010-05-28 12:51 dir_test1.d
-rw-r--r-- 1 ubuntu ubuntu 0 2010-05-28 12:50 file_test1.txt
ubuntu at ebox:/testhome/test$
Based on this testing, it looks like setuids works for files, but
only for Samba client 3.4.5. Using setuids for directories fails
completely. Since there is no error message printed, it looks like the
client is not even trying to set the directory UID.
These results are the same regardless of the Samba server version.
I tried it with an Ubuntu 9.10 server (Samba 3.4.0) and Ubuntu 10.4
server (Samba 3.4.7). All the pre-existing UIDs and GIDs seem to be
recognized correctly on the share, so I think the Unix extensions are
Is there anything else I can try? Looking at this earlier post, it
seems like maybe "setuids" is not even a supported option anymore...?
More information about the samba