USB File Sharing - can't modify files

Hi, I’m a new user and I’m trying to set up USB file sharing on my new MT1300 for access from Windows 10. I followed the gl.inet tutorial to enable SMB2 File Sharing (but not Multimedia), including the “security = user” change to the samba config file. It all works fine apart from one strange problem - I can’t overwrite existing files on the samba usb drive. I can create them and delete them, but I can’t overwrite them.

Dragging a file in Windows File explorer gives “Can’t read from the source file or disk”. And xcopy from a command prompt gives: “A device attached to the system is not functioning”.

To test this, I created a test.txt with Windows Notepad, I can drag it over to the samba drive ok. I can then continue to drag it and overwrite it ok. However, here’s the problem: if I then edit the file in Windows Notepad and save it, I can no longer drag it over. I get the errors as above. However I can still delete the file on the samba drive from Windows ok.

I tried various USB sticks, formatted with exFAT, NTFS, FAT32, but they all exhibit the same problem. It seems like a permissions thing. Maybe something to do with ACL? It doesn’t seem like I’m doing anything unusual. Thanks in advance!

Examining the Windows file properties on the samba share shows that no file has MODIFY privilege, only read & execute, read, write, and special. I guess that explains why I can’t overwrite them. So why does Windows show no modify privilege?

On the router, the attributes for /mnt and my NTFS USB stick /Backup are as follows:

root@GL-MT1300:~# ls -l /mnt
drwxrwxrwx 3 root root 131072 Nov 12 12:52 Backup
drwxr-xr-x 2 root root 0 Nov 11 15:33 FREECOM
drwxr-xr-x 2 root root 0 Nov 10 22:19 sdb1
drwxr-xr-x 2 root root 0 Nov 11 10:55 sdc1
root@GL-MT1300:~# ls -l /mnt/Backup
drwxrwxrwx 2 root root 131072 Nov 11 17:15 System Volume Information
-rwxrwxrwx 1 root root 1 Nov 11 18:08 temp2.txt
-rwxrwxrwx 1 root root 0 Nov 12 12:52 test.txt
root@GL-MT1300:~#

So if everything is 777 why can’t I overwrite a file?

My smb.conf.template:
[global]
netbios name = |NAME|
display charset = |CHARSET|
interfaces = |INTERFACES|
server string = |DESCRIPTION|
unix charset = |CHARSET|
workgroup = |WORKGROUP|
browseable = yes
deadtime = 30
domain master = yes
encrypt passwords = true
enable core files = no
guest account = nobody
guest ok = yes
invalid users = root
local master = yes
load printers = no
map to guest = Bad User
max protocol = SMB2
min receivefile size = 16384
null passwords = yes
obey pam restrictions = yes
os level = 20
passdb backend = smbpasswd
preferred master = yes
printable = no
security = user
smb encrypt = disabled
smb passwd file = /etc/samba/smbpasswd
socket options = TCP_NODELAY IPTOS_LOWDELAY
syslog = 2
use sendfile = yes
writeable = yes

Should you use “security = share” and remove “invalid users = root”

Then just use root as user?

What is the content of /etc/config/samba?

I have the same problem (for me is not critical), I check it.
After remove “invalid users = root” -not save.
And, after add “map archive = no” -not save.
After “security = share” (previously it was “user”) - I can not enter the shared resource.
I set up samba according to this guide:

Wireshark after client send this request:
Class: FILE_INFO (0x01) / InfoLevel: SMB2_FILE_ALLOCATION_INFO (0x13)
Say responce:
NT Status: STATUS_UNSUCCESSFUL (0xc0000001)
When this option “syslog = 10” in smb.conf.template is set, I do not see extended tracing anywhere, possible, “the log function has been disabled at compile time, due to security reasons (!?)”:

Hmm, I compiled a downgraded version of package “14” (it was in my buildroot) with debug level 10: samba36-server_3.6.25-14_mipsel_24kc.ipk and NO PROBLEM - files are saved.

Additional info: I tested on my new AR300 ))
root@GL-AR300M:~# opkg list_installed |grep samba
samba36-server - 3.6.25-14

  • NO PROBLEM saving the file
    OpenWrt 19.07.7, r11306-c4a6851c72
    Current Version 3.201
    Compile Time 2021-04-02 20:17:09

Hi, thanks for trying to help.

I changed “security = user” to “security = share” and rebooted, but couldn’t access the share at all from Windows. I recall reading something about this option not being recommended due to issues accessing the share from Windows. I returned it to ‘user’.

I commented out “invalid users = root” and restarted samba - no change.

I changed guest account to root as follows and restarted samba - no change:

comment guest account = nobody
guest account = root
guest ok = yes
comment invalid users = root

Didn’t seem to make any difference. I still can’t overwrite an existing file.

I don’t know if this makes any difference, but I should mention that I don’t have login password enabled on my Windows computer, and when I try to use the samba share, it doesn’t ask for any login. Perhaps this is an issue? Although I can still create and delete files on the samba share, just not overwrite existing files.

The samba.conf is:
[global]
netbios name = GL-MT1300
display charset = UTF-8
interfaces = lo br-lan
server string = GL-MT1300-52e
unix charset = UTF-8
workgroup = WORKGROUP
browseable = yes
deadtime = 30
domain master = yes
encrypt passwords = true
enable core files = no
comment guest account = nobody
guest account = root
guest ok = yes
comment invalid users = root
local master = yes
load printers = no
map to guest = Bad User
max protocol = SMB2
min receivefile size = 16384
null passwords = yes
obey pam restrictions = yes
os level = 20
passdb backend = smbpasswd
preferred master = yes
printable = no
security = user
smb encrypt = disabled
smb passwd file = /etc/samba/smbpasswd
socket options = TCP_NODELAY IPTOS_LOWDELAY
syslog = 2
use sendfile = yes
writeable = yes

[homes]
comment = Home Directories
browsable = no
read only = no
create mode = 0750

[GL-Samba]
path = /mnt/Backup
read only = no
guest ok = yes

And /etc/config/samba is:

config samba
option workgroup ‘WORKGROUP’
option homes ‘1’
option name ‘GL-MT1300’
option description ‘GL-MT1300-52e’
option interface 'loopback lan ’

config sambashare
option guest_ok ‘yes’
option name ‘GL-Samba’
option read_only ‘no’
option path ‘/mnt/Backup’

Thanks Andrew but I don’t know what package 14 is. I’m using whatever came with my MT1300 out of the box and upgraded to 3.202 dated 2021-08-09 16:28:30.

I think only @alzhao can help with this.

Thanks for the additional info AndrewPN. Interesting that the AR300M works. I chose the MT1300 since it had Gbit port and USB3 so perfect for a simple automated remote backup. The AR300M has only 100Mbit and USB2 so not a great match for me.

I also found that even deleting files via SMB was unreliable. Random files would fail as “in use” and I had to SSH in and rm -rf them. Sadly I’m gonna have to return the MT1300 as not fit for purpose :cry:

I will call for one developer to help. Is it possbile to do remote check?

I’m not happy for you to remote into my computer, but thanks for offering.

I downgraded my 3.203 back to 3.200 to get samba36-server_3.6.25-14 but the failure to overwrite still happened (AndrewPN suggested I try -14 instead of -15).

I can tell you that the same samba share works with my MacBook connecting as “guest” (and running “smbutil statshares -a” on the Mac shows SMB2.002 was negotiated).

No problem. I can still ask developer to follow. Did you send the email to support? We will reply there.

Thank you. support has just replied with new “-16” server ipk to try, I will let you know.

samba36-server_3.6.25-16 fixed the issue - thank you very much! :smiley: :clap:

Thanks for your feedback, I post the fix method with .ipk file here.
Samba-Server update and install method.zip (825.5 KB)