Hi,
I hope this is the right place to post this, but after two days of
trying to solve the problem with the internet I feel I have to go to the
source of the code. I hope I am right here.
Long story short, I am running a Samba server with enabled UNIX
extensions on a Debian OS.
$ uname -a
Linux ... 3.16-3-amd64 #1 SMP Debian 3.16.5-1 (2014-10-10) x86_64
GNU/Linux
$ samba-tool -V
4.1.13-Debian
I am mounting the share (though the first attempt ALWAYS fails!) on the
command line.
# mount -v -t cifs -o noauto,rw,setuids,soft,posixpaths
//host.domain.com/data /media/host.data
Password for root@//host.domain.com/data: **********
mount.cifs kernel mount options:
ip=127.0.1.1,unc=\\host.domain.com\data,setuids,soft,posixpaths,user=root,pass=********
mount error(5): Input/output error
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
$ mount -v -t cifs -o noauto,rw,setuids,soft,posixpaths
//host.domain.com/data /media/host.data
Password for root@//host.domain.com/data: **********
mount.cifs kernel mount options:
ip=127.0.1.1,unc=\\host.domain.com\data,setuids,soft,posixpaths,user=root,pass=********
$
When I work as root (the user that has mounted the share) everything
works fine.
If I try to create a file or directory, in a folder of the mounted
share,the file or directory is created but with the user root and group
root instead of the correct user.
$ mkdir testdir
$ touch testfile
touch: cannot touch ‘testfile’: Permission denied
$ echo adsfdsaf >testfile2
-bash: testfile2: Permission denied
$ ll
total 0
drwxr-xr-x 2 root root 0 Nov 27 01:27 testdir
-rw-r--r-- 1 root root 0 Nov 27 01:27 testfile
-rw-r--r-- 1 root root 0 Nov 27 01:28 testfile2
$
As you can see the files and directories are created but the owner is
root instead of alex.
I have the following options enabled in /etc/samba/smb.conf.
unix extensions = yes
case sensitive = yes
delete readonly = yes
ea support = yes
It looks like if the UNIX extensions are enabled and working.
$ cat LinuxExtensionsEnabled
1
$
I also mounted the share with the setuids option which should fix exact
this behaviour. The uid and gid of the user alex are the same on the
client and on the samba server host. Even mounting the share on the
samba server host produces the exact same result. Client 1 runs Ubuntu
14.10 and, client 2 is on the Debian server see above, same result on
both!
So I guess it has something to do with the user handling, because it
looks like the server is falling back to the mounting user as described
in the man page to mount.cifs section setuids. But even tracing the
communication with
$ echo 7 > /proc/fs/cifs/cifsFYI
$ echo 1 > /proc/fs/cifs/traceSMB
Nov 27 00:46:16 belegaer kernel: [1863123.954794]
/build/buildd/linux-3.16.0/fs/cifs/dir.c: CIFS VFS: in cifs_atomic_open
as Xid: 94685 with uid: 1000
Nov 27 00:46:16 belegaer kernel: [1863123.954799]
/build/buildd/linux-3.16.0/fs/cifs/dir.c: parent inode =
0xffff88036206bb68 name is: test6.txt and dentry = 0xffff8804250599c0
Nov 27 00:46:16 belegaer kernel: [1863123.954804]
/build/buildd/linux-3.16.0/fs/cifs/dir.c: name: /test6.txt
Nov 27 00:46:16 belegaer kernel: [1863123.954806]
/build/buildd/linux-3.16.0/fs/cifs/dir.c: name: /alex/test6.txt
Nov 27 00:46:16 belegaer kernel: [1863123.954807]
/build/buildd/linux-3.16.0/fs/cifs/dir.c: name: /wrk/alex/test6.txt
Nov 27 00:46:16 belegaer kernel: [1863123.954809]
/build/buildd/linux-3.16.0/fs/cifs/file.c: posix open
/wrk/alex/test6.txt
Nov 27 00:46:16 belegaer kernel: [1863123.954812]
/build/buildd/linux-3.16.0/fs/cifs/cifssmb.c: In POSIX Create
Nov 27 00:46:16 belegaer kernel: [1863123.954818]
/build/buildd/linux-3.16.0/fs/cifs/transport.c: For smb_command 50
Nov 27 00:46:16 belegaer kernel: [1863123.954821]
/build/buildd/linux-3.16.0/fs/cifs/transport.c: Sending smb: smb_len=132
Nov 27 00:46:16 belegaer kernel: [1863123.957867]
/build/buildd/linux-3.16.0/fs/cifs/connect.c: RFC1002 header 0xac
Nov 27 00:46:16 belegaer kernel: [1863123.957876]
/build/buildd/linux-3.16.0/fs/cifs/misc.c: checkSMB Length: 0xb0,
smb_buf_length: 0xac
Nov 27 00:46:16 belegaer kernel: [1863123.957903]
/build/buildd/linux-3.16.0/fs/cifs/transport.c: cifs_sync_mid_result:
cmd=50 mid=20690 state=4
Nov 27 00:46:16 belegaer kernel: [1863123.957908]
/build/buildd/linux-3.16.0/fs/cifs/cifssmb.c: copying inode info
Nov 27 00:46:16 belegaer kernel: [1863123.957912]
/build/buildd/linux-3.16.0/fs/cifs/inode.c: looking for
uniqueid=313393291
Nov 27 00:46:16 belegaer kernel: [1863123.957920]
/build/buildd/linux-3.16.0/fs/cifs/inode.c: cifs_revalidate_cache:
revalidating inode 313393291
Nov 27 00:46:16 belegaer kernel: [1863123.957922]
/build/buildd/linux-3.16.0/fs/cifs/inode.c: cifs_revalidate_cache: inode
313393291 is new
Nov 27 00:46:16 belegaer kernel: [1863123.957931]
/build/buildd/linux-3.16.0/fs/cifs/misc.c: Exclusive Oplock granted on
inode ffff880376e1b298
Nov 27 00:46:16 belegaer kernel: [1863123.957933]
/build/buildd/linux-3.16.0/fs/cifs/dir.c: CIFS VFS: leaving
cifs_atomic_open (xid = 94685) rc = 0
Nov 27 00:46:16 belegaer kernel: [1863123.957941]
/build/buildd/linux-3.16.0/fs/cifs/file.c: closing last open instance
for inode ffff880376e1b298
Nov 27 00:46:16 belegaer kernel: [1863123.957943]
/build/buildd/linux-3.16.0/fs/cifs/file.c: CIFS VFS: in cifsFileInfo_put
as Xid: 94686 with uid: 1000
Nov 27 00:46:16 belegaer kernel: [1863123.957944]
/build/buildd/linux-3.16.0/fs/cifs/cifssmb.c: In CIFSSMBClose
Nov 27 00:46:16 belegaer kernel: [1863123.957947]
/build/buildd/linux-3.16.0/fs/cifs/transport.c: For smb_command 4
Nov 27 00:46:16 belegaer kernel: [1863123.957949]
/build/buildd/linux-3.16.0/fs/cifs/transport.c: Sending smb: smb_len=41
Nov 27 00:46:16 belegaer kernel: [1863123.960868]
/build/buildd/linux-3.16.0/fs/cifs/connect.c: RFC1002 header 0x23
Nov 27 00:46:16 belegaer kernel: [1863123.960882]
/build/buildd/linux-3.16.0/fs/cifs/misc.c: checkSMB Length: 0x27,
smb_buf_length: 0x23
Nov 27 00:46:16 belegaer kernel: [1863123.960925]
/build/buildd/linux-3.16.0/fs/cifs/transport.c: cifs_sync_mid_result:
cmd=4 mid=20691 state=4
Nov 27 00:46:17 belegaer kernel: [1863124.515447]
/build/buildd/linux-3.16.0/fs/cifs/inode.c: CIFS VFS: in
cifs_revalidate_dentry_attr as Xid: 94687 with uid: 0
Nov 27 00:46:17 belegaer kernel: [1863124.515469]
/build/buildd/linux-3.16.0/fs/cifs/inode.c: Update attributes: inode
0xffff880376e1bb68 count 2 dentry: 0xffff880371e0b0c0 d_time
-114445832977592 jiffies 4760368120
Nov 27 00:46:17 belegaer kernel: [1863124.515473]
/build/buildd/linux-3.16.0/fs/cifs/inode.c: Getting info on
Nov 27 00:46:17 belegaer kernel: [1863124.515475]
/build/buildd/linux-3.16.0/fs/cifs/cifssmb.c: In QPathInfo (Unix) the
path
Nov 27 00:46:17 belegaer kernel: [1863124.515484]
/build/buildd/linux-3.16.0/fs/cifs/transport.c: For smb_command 50
Nov 27 00:46:17 belegaer kernel: [1863124.515487]
/build/buildd/linux-3.16.0/fs/cifs/transport.c: Sending smb: smb_len=74
Nov 27 00:46:17 belegaer kernel: [1863124.518580]
/build/buildd/linux-3.16.0/fs/cifs/connect.c: RFC1002 header 0xa0
Nov 27 00:46:17 belegaer kernel: [1863124.518595]
/build/buildd/linux-3.16.0/fs/cifs/misc.c: checkSMB Length: 0xa4,
smb_buf_length: 0xa0
Nov 27 00:46:17 belegaer kernel: [1863124.518650]
/build/buildd/linux-3.16.0/fs/cifs/transport.c: cifs_sync_mid_result:
cmd=50 mid=20692 state=4
Nov 27 00:46:17 belegaer kernel: [1863124.518661]
/build/buildd/linux-3.16.0/fs/cifs/inode.c: cifs_revalidate_cache:
revalidating inode 313393153
Nov 27 00:46:17 belegaer kernel: [1863124.518664]
/build/buildd/linux-3.16.0/fs/cifs/inode.c: cifs_revalidate_cache: inode
313393153 is unchanged
Nov 27 00:46:17 belegaer kernel: [1863124.518668]
/build/buildd/linux-3.16.0/fs/cifs/inode.c: CIFS VFS: leaving
cifs_revalidate_dentry_attr (xid = 94687) rc = 0
Nov 27 00:46:17 belegaer kernel: [1863124.520312]
/build/buildd/linux-3.16.0/fs/cifs/inode.c: CIFS VFS: in
cifs_revalidate_dentry_attr as Xid: 94688 with uid: 0
Nov 27 00:46:17 belegaer kernel: [1863124.520323]
/build/buildd/linux-3.16.0/fs/cifs/inode.c: Update attributes: inode
0xffff8800079fc0a8 count 2 dentry: 0xffff880376500780 d_time
-72039585256828832 jiffies 4760368121
Nov 27 00:46:17 belegaer kernel: [1863124.520326]
/build/buildd/linux-3.16.0/fs/cifs/inode.c: Getting info on
Nov 27 00:46:17 belegaer kernel: [1863124.520329]
/build/buildd/linux-3.16.0/fs/cifs/cifssmb.c: In QPathInfo (Unix) the
path
Nov 27 00:46:17 belegaer kernel: [1863124.520338]
/build/buildd/linux-3.16.0/fs/cifs/transport.c: For smb_command 50
Nov 27 00:46:17 belegaer kernel: [1863124.520341]
/build/buildd/linux-3.16.0/fs/cifs/transport.c: Sending smb: smb_len=74
Nov 27 00:46:17 belegaer kernel: [1863124.520911]
/build/buildd/linux-3.16.0/fs/cifs/cifsfs.c: CIFS VFS: in cifs_statfs as
Xid: 94689 with uid: 0
Nov 27 00:46:17 belegaer kernel: [1863124.520917]
/build/buildd/linux-3.16.0/fs/cifs/cifssmb.c: In QFSPosixInfo
Nov 27 00:46:17 belegaer kernel: [1863124.520923]
/build/buildd/linux-3.16.0/fs/cifs/transport.c: For smb_command 50
Nov 27 00:46:17 belegaer kernel: [1863124.520926]
/build/buildd/linux-3.16.0/fs/cifs/transport.c: Sending smb: smb_len=68
Nov 27 00:46:17 belegaer kernel: [1863124.521725]
/build/buildd/linux-3.16.0/fs/cifs/connect.c: RFC1002 header 0xa0
Nov 27 00:46:17 belegaer kernel: [1863124.521735]
/build/buildd/linux-3.16.0/fs/cifs/misc.c: checkSMB Length: 0xa4,
smb_buf_length: 0xa0
Nov 27 00:46:17 belegaer kernel: [1863124.521752]
/build/buildd/linux-3.16.0/fs/cifs/transport.c: cifs_sync_mid_result:
cmd=50 mid=20693 state=4
Nov 27 00:46:17 belegaer kernel: [1863124.521762]
/build/buildd/linux-3.16.0/fs/cifs/inode.c: cifs_revalidate_cache:
revalidating inode 28068
Nov 27 00:46:17 belegaer kernel: [1863124.521766]
/build/buildd/linux-3.16.0/fs/cifs/inode.c: cifs_revalidate_cache: inode
28068 is unchanged
Nov 27 00:46:17 belegaer kernel: [1863124.521770]
/build/buildd/linux-3.16.0/fs/cifs/inode.c: CIFS VFS: leaving
cifs_revalidate_dentry_attr (xid = 94688) rc = 0
Nov 27 00:46:17 belegaer kernel: [1863124.524813]
/build/buildd/linux-3.16.0/fs/cifs/connect.c: RFC1002 header 0x70
Nov 27 00:46:17 belegaer kernel: [1863124.524827]
/build/buildd/linux-3.16.0/fs/cifs/misc.c: checkSMB Length: 0x74,
smb_buf_length: 0x70
Nov 27 00:46:17 belegaer kernel: [1863124.524881]
/build/buildd/linux-3.16.0/fs/cifs/transport.c: cifs_sync_mid_result:
cmd=50 mid=20694 state=4
Nov 27 00:46:17 belegaer kernel: [1863124.524891]
/build/buildd/linux-3.16.0/fs/cifs/cifsfs.c: CIFS VFS: leaving
cifs_statfs (xid = 94689) rc = 0
Nov 27 00:46:17 belegaer kernel: [1863124.526191]
/build/buildd/linux-3.16.0/fs/cifs/cifsfs.c: CIFS VFS: in cifs_statfs as
Xid: 94690 with uid: 0
Nov 27 00:46:17 belegaer kernel: [1863124.526194]
/build/buildd/linux-3.16.0/fs/cifs/cifssmb.c: In QFSPosixInfo
Nov 27 00:46:17 belegaer kernel: [1863124.526199]
/build/buildd/linux-3.16.0/fs/cifs/transport.c: For smb_command 50
Nov 27 00:46:17 belegaer kernel: [1863124.526201]
/build/buildd/linux-3.16.0/fs/cifs/transport.c: Sending smb: smb_len=68
Nov 27 00:46:17 belegaer kernel: [1863124.529270]
/build/buildd/linux-3.16.0/fs/cifs/connect.c: RFC1002 header 0x70
Nov 27 00:46:17 belegaer kernel: [1863124.529281]
/build/buildd/linux-3.16.0/fs/cifs/misc.c: checkSMB Length: 0x74,
smb_buf_length: 0x70
Nov 27 00:46:17 belegaer kernel: [1863124.529329]
/build/buildd/linux-3.16.0/fs/cifs/transport.c: cifs_sync_mid_result:
cmd=50 mid=20695 state=4
Nov 27 00:46:17 belegaer kernel: [1863124.529339]
/build/buildd/linux-3.16.0/fs/cifs/cifsfs.c: CIFS VFS: leaving
cifs_statfs (xid = 94690) rc = 0
I am not able to find the problem. So please ANY help would be really
appreciated!
ps fixing the error (5) on first mount would be great too!
thanks in advance,
with best regards,
alex burker
--
To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html