[Samba] permission bit headache

dave selby dave6502 at googlemail.com
Thu Jun 28 18:22:04 GMT 2007


Hi all,

I am configuring a samba server on kubuntu 7.04, samba 3.x but am
having permission bit problems. I have googled, read, experimented but
am still stuck. I am trying to allow the permissions to be set on the
files in my shares without restriction, so I have set various masks to
no avail. This is my configuration and problem ...

With the samba server running on my machine, and a need for me to
access it I wrote the following script that starts up after the samba
server has started.

# To get round running samba server and access samba on same machine
# and to make the mounting process bombproof
smb_mount() {

declare -i i=0
until cat /etc/mtab | grep //127.0.0.1/$1 &> /dev/null ||  [ $i -ge 3 ]; do

    mount -t smbfs //127.0.0.1/$1 /mnt/$1 -o
credentials=/home/dave/.smbpw,uid=dave,gid=dave,fmask=$2,dmask=$3,lfs
    sleep 2
    i=$i+1
done
}

smb_mount common 0777 0777 &
smb_mount windows 0777 0777 &
smb_mount archive 0777 0777 &
root at dave-desktop:~#

It mounts my three shares as /mnt/common ... windows & archive as
expected. (the whole timing loop thing is because sometimes samba has
not fully started up at this point) With a /etc/profile umask of 077

drwxrwxrwx 1 dave dave 4096 2007-06-28 18:45 .
drwxrwx--- 5 root dave 4096 2007-06-27 22:37 ..
drwxrwxrwx 1 dave dave 4096 2007-06-25 18:32 film
drwxrwxrwx 1 dave dave 4096 2007-06-25 18:35 music
dave at dave-desktop:/mnt/common$ touch test
dave at dave-desktop:/mnt/common$ ls -al
total 16
drwxrwxrwx 1 dave dave 4096 2007-06-28 18:45 .
drwxrwx--- 5 root dave 4096 2007-06-27 22:37 ..
drwxrwxrwx 1 dave dave 4096 2007-06-25 18:32 film
drwxrwxrwx 1 dave dave 4096 2007-06-25 18:35 music
-rwxrwxrwx 1 dave dave    0 2007-06-28 19:08 test
dave at dave-desktop:/mnt/common$

kind of expected test to have permissions of
-rw-------

dave at dave-desktop:/mnt/common$ chmod a-rwx test
dave at dave-desktop:/mnt/common$ ls -al
total 16
drwxrwxrwx 1 dave dave 4096 2007-06-28 18:45 .
drwxrwx--- 5 root dave 4096 2007-06-27 22:37 ..
drwxrwxrwx 1 dave dave 4096 2007-06-25 18:32 film
drwxrwxrwx 1 dave dave 4096 2007-06-25 18:35 music
-r-xr-xr-x 1 dave dave    0 2007-06-28 19:08 test
dave at dave-desktop:/mnt/common$

so why are there still r & x bits set ?


Its probarbly best if I show you my smb.conf file - any help much
appreciated. I have already setup ...

    create mode = 0777
    directory mode = 0777
    force create mode = 0
    force directory mode = 0
    security mask = 0777
    force security mode = 0
    directory security mask = 0777
    force directory security mode = 0

in [global] to try and enforce open permission bits, though most are
supposed to default to non restrictive masks.

Any help or pointers would be very much appreciated :)

Cheers

Dave


##################################################################


[global]
    comment = Samba Server

    netbios name = DAVE-DESKTOP
    server string = %v on %L

    workgroup = OFFICE
    wins support = yes
    security = user

    # Max permissions for a share
    create mode = 0777
    directory mode = 0777

    force create mode = 0
    force directory mode = 0

    security mask = 0777
    force security mode = 0
    directory security mask = 0777
    force directory security mode = 0

    # Only on my LAN
    hosts allow = 127.0.0.1 192.168.0.0/24
    hosts deny = 0.0.0.0/0

    # Only on eth1
    interfaces = eth1 lo
    bind interfaces only = yes

    # Various system users and superusers cannot be forged for access
    invalid users = root bin daemon adm sync shutdown halt mail news
uucp operator

    # Stop symink outside of share tree
    wide links = no

    # Hide .??? files from windows
    hide dot files = yes

    # M$ idea, can increase speed on busy network
    # can also be dodgy & unreliable !!
    level2 oplocks = no
    oplocks = no

    # Setup logging
    #syslog = 1
    # syslog 3 for more thorough logging to syslog
    syslog = 3

    log file = /var/log/samba/log.%m
    max log size = 1000
    debug timestamp = yes

[common]
    comment = Common Linux Directory
    path = /export/samba/common
    read only = no
    valid users = @smblinux

[windows]
    comment = M$ Directory
    path = /export/samba/windows
    read only = no
    valid users = @smbwindows

[archive]
    comment = Archive Linux Directory
    path = /export/samba/archive
    read only = no
    valid users = @smblinux

[epson]
    printable = yes
    printing = BSD
    path = /var/spool/samba
    guest ok = yes



-- 

Please avoid sending me Word or PowerPoint attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html


More information about the samba mailing list