[Samba] Fwd: permissions on samba share change automatically

jan vereecke vereecke.jan at gmail.com
Mon May 14 13:32:09 GMT 2007


I already sent the mail below to linux-cifs-client, but got no reaction
there. Sorry if this is considered crossposting.

I have a problem executing certain actions on a share, which is shared by a
windows XP Home machine and mounted by a linux machine


First of all some information:

in /etc/fstab
Quote:
//Venus/D_ /mnt/D cifs
users,gid=smb,file_mode=0770,dir_mode=0770,iocharset=iso8859-15,credentials=/etc/samba/credentials
0 0


Venus is a Windows XP home machine, sharing D_ using 'Simple Sharing' (which
as I understand gives rw access to anybody, including guest.)

if I open xterm, I can do

Code:
cd /mnt/D
mkdir test6
ls -ld test* # in previous attempts I had already created the other testx
directories
drwxrwx--- 1 root smb     0 Feb 28 21:50 test3/
drwxrwx--- 1 root smb     0 Feb 28 21:52 test4/
drwxrwx--- 1 root smb     0 Feb 28 21:52 test5/
drwxr-xr-x 2 root smb     0 Feb 28 21:52 test6/
ls -ld test* # I can repeat the command as many times as I want, without the
permissions of test6 being different from 750, although I had expected 770

ls -ld test6
drwxrwx--- 1 root smb 0 Feb 28 21:52 test6/
# WOW, permissions suddenly changed

ls -ld test*
drwxrwx--- 1 root smb 0 Feb 28 21:50 test3/
drwxrwx--- 1 root smb 0 Feb 28 21:52 test4/
drwxrwx--- 1 root smb 0 Feb 28 21:52 test5/
drwxrwx--- 1 root smb 0 Feb 28 21:52 test6/
# and they remain changed as of now !!


I see similar behaviour in thunar (that's how I first found out about this),
where I sometimes could write files in newly created directories or
sometimes not. Specifically, I cannot currently use cp -r to the share.

Anyhow, I believe this must be a problem with the way cifs has been setup.
Can anyone explain what is happening here ?

By the way, in my kernel's .config, I have for kernel 2.6.18
Quote:
#
# Network File Systems
#
CONFIG_NFS_FS=m
CONFIG_NFS_V3=y
# CONFIG_NFS_V3_ACL is not set
# CONFIG_NFS_V4 is not set
# CONFIG_NFS_DIRECTIO is not set
CONFIG_NFSD=m
CONFIG_NFSD_V3=y
# CONFIG_NFSD_V3_ACL is not set
# CONFIG_NFSD_V4 is not set
CONFIG_NFSD_TCP=y
CONFIG_LOCKD=m
CONFIG_LOCKD_V4=y
CONFIG_EXPORTFS=m
CONFIG_NFS_COMMON=y
CONFIG_SUNRPC=m
# CONFIG_RPCSEC_GSS_KRB5 is not set
# CONFIG_RPCSEC_GSS_SPKM3 is not set
CONFIG_SMB_FS=m
CONFIG_SMB_NLS_DEFAULT=y
CONFIG_SMB_NLS_REMOTE="cp850"
CONFIG_CIFS=m
CONFIG_CIFS_STATS=y
# CONFIG_CIFS_STATS2 is not set
# CONFIG_CIFS_XATTR is not set
# CONFIG_CIFS_EXPERIMENTAL is not set
# CONFIG_NCP_FS is not set
# CONFIG_CODA_FS is not set
# CONFIG_AFS_FS is not set
# CONFIG_9P_FS is not set

I saw that permissions are not the only thing that changes. after doing ls
-ld test6, the number immediately after the permissions decreases too.
According to `man ls`, this number indicates the number of links to the
file. From checking with other directories, I understand this number
indicates the number of subdirectories.

FYI, I can mount the same share with mount -t smbfs without the above
problem

The summary: a newly created directory does not show the correct permissions
until the contents of the directory is listed.
How should I mount to get the correct permissions immediately upon creation
of a directory ?


More information about the samba mailing list