Unable to gain write access in samba share drive

You need to determine your mount point directory e.g. /mnt/sda1 or /mnt/sdb1 or /mnt/sdxx

Importanty! the directory(s) have to exist prior to any USB drive mount.

cat /proc/mounts will advise you of the mount directory...
e.g. this output /dev/sdb1 /mnt/sda1 exfat tells you it's mounted to /mnt/sda1

confim the directory exists, in the above case
ls -l /mnt/sda1
then apply the chmod commands to the proper mount point directory, in the above case
chmod -R 777 /mnt/sda1

Apart from this I'm out of ideas.

root@OpenWrt:/mnt/sda1# cat /proc/mounts
/dev/root /rom squashfs ro,relatime 0 0
proc /proc proc rw,nosuid,nodev,noexec,noatime 0 0
sysfs /sys sysfs rw,nosuid,nodev,noexec,noatime 0 0
tmpfs /tmp tmpfs rw,nosuid,nodev,noatime 0 0
/dev/mtdblock6 /overlay jffs2 rw,noatime 0 0
overlayfs:/overlay / overlay rw,noatime,lowerdir=/,upperdir=/overlay/upper,workdir=/overlay/work 0 0
tmpfs /dev tmpfs rw,nosuid,relatime,size=512k,mode=755 0 0
devpts /dev/pts devpts rw,nosuid,noexec,relatime,mode=600,ptmxmode=000 0 0
debugfs /sys/kernel/debug debugfs rw,noatime 0 0
/dev/sda1 /mnt/sda1 exfat rw,relatime,fmask=0022,dmask=0022,codepage=cp437,iocharset=utf8,namecase=0,errors=remount-ro 0 0

Thanks a lot for helping out... I will give this a rest for a while then get back to it.

If I remember correctly, the mount points are removed on every reboot, only /mnt is persistent.

If you' like to have 777, you have to manually create the /mnt/mountpoint and afterwards do a
chmod on it.

It can be added to the local startup script in System->Startup->Local Startup.

uci set fstab.@mount[-1].options="umask=0"
uci commit fstab
block umount
block mount

Aaaaand , there it was.

I didn't feel like digging to deep into the issue, when I had it.
Quick and dirty worked, at that time :wink:

Thanks a lot guys... i think i fixed it somehow... i don't know what i did but the permissions are set now.

drwxrwxrwx 9 root root 4096 Jan 1 1970 sda1
I can access it using my created user/password with full RW permissions.
I think i may've messed around with mounting points. Don't know exactly what fixed it.

This is my luci page and everything works

config samba                                                                           
        option name 'OpenWrt'                                                          
        option workgroup 'WORKGROUP'                                                   
        option description 'OpenWrt'                                                   
        option homes '0'                                                               
config sambashare                                                                      
        option browseable 'yes'                                                        
        option name 'saharename'                                                       
        option path '/share'                                                           
        option read_only 'no'                                                          
        option guest_ok 'yes'                                                          
        option create_mask '777'                                                       
        option dir_mask '777'
        netbios name = OpenWrt                                                         
        display charset = UTF-8                                                        
        interfaces = lo br-lan                                                         
        server string = OpenWrt                                                        
        unix charset = UTF-8                                                           
        workgroup = WORKGROUP                                                          
        bind interfaces only = yes                                                     
        deadtime = 30                                                                  
        enable core files = no                                                         
        invalid users = root                                                           
        local master = no                                                              
        map to guest = Bad User                                                        
        max protocol = SMB2                                                            
        min receivefile size = 16384                                                   
        null passwords = yes                                                           
        passdb backend = smbpasswd                                                     
        security = user                                                                
        smb passwd file = /etc/samba/smbpasswd                                         
        use sendfile = yes                                                             
        path = /share                                                                  
        read only = no                                                                 
        guest ok = yes                                                                 
        create mask = 777                                                              
        directory mask = 777                                                           
        browseable = yes

Thanks... I think the issue has been resolved (i think so) by using the root user for samba login on clients. Also about the permission not changing, it's due to my fat32 formatting, it's behavior is quite normal on linux platform. I think i am fine with current settings as they are. It would've been easy if i could just format it into ext2/3 but unfortunately i can't due to many reasons.

This typically depends on the mount options, so specifying umask=0 should help.

They are already set.

Anyway i am fine with it as long as it works...

1 Like

In template file


add one line at the end

force user = root

This will violate all Linux security principles, so use it on your own risk :slight_smile: But if you are in a controlled environment where you manage in some other way who is accessing your network, this a solution until you find something smarter. At least do not allow samba access over the wan port.

Good luck!

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.