Yet another post about OpenWRTs samba not working in windows

I been messing with samba for OpenWRT on my Netgear R7800 router.

First, I mounted my 14TB drive that was already formatted to EXT4. shared it via samba through the LUCI web gui and everything went well.

then I replace the drive with my 8TB hard drive, re-setup the share again, and now it wont work. I can access the share via winSCP but not through windows network explorer.

Like when you click on the folder icon, click on network in the left side of the window, double click on the router itself, and then the share. which is where I am stuck at right now.

I can temporally fix it by enabling "force root" on the share in samba but I dont want to do that. I want to get it working the same way it was working before when I had the 14TB drive hooked up to the router.

I tried to do a factory reset and started all over again, but still stuck. something tells me that its possible this might be a windows issue but im not sure.

Have you tried to re-add the share in windows?

its strange because if you say it works in Linux and not in Windows i guess a permission issue is also out of the window then :thinking:

I need some more information, can you show some logs, network configuration and firewall, for example did you used a samba password before you did a reset?

i do know if you share had a password it generally doesn't use the linux passwd list for shares, but it uses smbpasswd, you could try using smbpasswd -a root which setup root as a samba user with a samba share password.

Or if you don't want root due security, you can always use shadow-adduser or shadow-useradd opkg to create a new user and then use smbpasswd -a username for that user, in luci your samba share need then also to reflect the same then.

The failure description kind of suggests an issue with the access permissions to the mounted filesystem (chown -R <user> <mount_point> might be in order, maybe also `chmod -R <desired_access_permissions> <mount_point>').

…one of several potential causes, but the one on top of my mind following your description.

I want to mention that I am strictly a windows user on the desktop/laptop/x86/x64 in general. No where in my first post did I mention I use Linux. the only time I use linux is when I am doing a router recovery that requires tools that only work in linux.

No password was setup for the samba share. I never setup a password for any samba shares in my own home. They are using "guest" or "anonymous" with read and write permissions.

Ah please forgive my misreading, then like @slh said, it's likely permission related.

1 Like

I can try to retrieve the config files for you so that you know how the share is currently setup. I did it all through the LUCI gui or webgui. I will try to retrieve those for you in a moment unless you know of some commands I can use. I saw them somewhere on those forums in my search on how to resolve this problem.

If you know how to use ssh, you could try to use:

ls -l <location> this should show a list with folders and their permissions and ownership, it would be interesting to see what it is on the mount location.

Maybe also some network configuration and firewall would be interesting too depending if you try reaching it from other firewall zones or subnet.

I know how to use ssh, but you will need to tell me what you mean by "locations" in the command you provided.

something like "ls -l /mnt/sda1/"?

Yes that is exactly what I mean, but maybe remove one slash at the end because you want to know the exact folder too :+1:

it appears to be showing for each individual file/folder on the drive.

root@GAKs_1337_Router:~# ls -l /mnt/sda1
-rwxrwxrwx    1 1000     1000         51643 May 17  2021 1dc41072f7684d4edf1438a                                                  cb85883a8.jpg
drwxr-xr-x   12 1000     1000          4096 Apr  7  2023 COMPUTER ROOM
drwxrwxrwx    3 1000     1000          4096 Apr  8  2023 Camera Roll
drwxrwxrwx   10 1000     1000          4096 Apr  8  2023 Documents
drwxrwxrwx    3 1000     1000          4096 Nov 28 01:12 Downloads
-rwxr--r--    1 1001     1001      72904328 May 18  2023 Java_Runtime_Environmen                                                  t_(32bit)_v8_Update_271.exe
drwxrwxrwx    3 1000     1000          4096 Apr  8  2023 LG Leon
drwxrwxrwx   86 1000     1000          4096 Apr  8  2023 Music
drwxrwxrwx   49 1000     1000         20480 Apr  8  2023 Pictures
-rwxr--r--    1 1000     1000        363008 Jan 25  2023 Thumbs.db
drwxr-xr-x    3 root     root          4096 May 18  2023 Unifi-Video
drwxrwxrwx   19 1000     1000          4096 Apr  8  2023 Videos
-rwxr--r--    1 root     root        162938 Dec 18  2017 WIN_20171202_23_41_51_P                                                  ro.jpg
-rwxr--r--    1 1001     1001      83364488 May 18  2023 jre-8u271-windows-x64.e                                                  xe
drwx------    2 1000     1000         16384 Apr  7  2023 lost+found
drwxrwxrwx    2 1000     1000          4096 Apr  8  2023 phone screens
-rwxr--r--    1 1000     1000        576756 Feb 22  2023 tftpd64-4.62-setup.exe
drwxrwxrwx    5 1000     1000          4096 Feb 25  2023 transmission_config
drwxrwxrwx   11 1000     1000          4096 Apr  8  2023 ts
root@GAKs_1337_Router:~#
1 Like

Its user 1000 so you can do two things:

Either create a user with opkg shadow-useradd or shadow-adduser, the command is typical useradd I always confuse them with user and add :yum:

and then with smbpasswd -a 1000 if you want a password i guess empty is also allowed.

Or you use:

chown -R root /mnt/sda1

Which means it recursive changes ownership to root.

Im only not sure if user 1000 is really needed for samba.

found another set of commands from this post Problem with Samba sharing - #4 by Alpha1096

root@GAKs_1337_Router:~# cat /etc/config/samba4

config samba
        option workgroup 'GAKSROOM'
        option charset 'UTF-8'
        option description 'Samba on OpenWRT'
        option interface 'lan'

config sambashare
        option name 'WD_Red_8TB'
        option path '/mnt/sda1/'
        option read_only 'no'
        option guest_ok 'yes'
        option create_mask '0666'
        option dir_mask '0777'

root@GAKs_1337_Router:~# cat /etc/config/fstab

config global
        option anon_swap '0'
        option anon_mount '0'
        option auto_swap '1'
        option auto_mount '1'
        option delay_root '5'
        option check_fs '0'

config mount
        option target '/mnt/sda1'
        option uuid '4ff1d062-c759-4235-b7ed-d1adf4c329dc'
        option enabled '1'

config swap
        option uuid 'f6cccbb3-4cdf-42ef-b215-9f3f69ab63d6'
        option enabled '1'

root@GAKs_1337_Router:~#

Hope this is useful to you all.

Probably not helpful, but I actually experienced an issue with samba sharing myself yesterday - samba guest share was perfectly accessible from Windows 11 desktop and iPhone 15, but not Windows 11 laptop. When I tried to open the guest share on the laptop, I was prompted to enter credentials and for whatever reason the fallback to guest just didn't seem to kick in. I found by entering username: 'guest', password 'guest' (presumably these could be random?), I was able to get into the share. Presumably this relates to the 'map to guest' facility in samba? In any case, after this, I was able to access the share from my laptop again as normal.

1 Like

I still think its a permission error like i mentoined earlier.

This shows the samba config so far it looks ok, though you might have no write access since i see 0666 as mask, you could temporary set it to 0755 the create_mask option.

Another thing could be a uuid mismatch, but i doubt this is a issue if it is, you could install blkid and then type blkid to see if uuid matches with in the samba config.

Not to hijack the thread, but I have a question. Is there any reason not to remove the configuration option: 'invalid users = root' and have the 'root' user access samba share, mindful that OpenWrt only really uses one 'root' user? Hitherto I have just made use of guest access, but I'm wondering whether it might increase security to require root/password like how the same is needed for logging into router.

Windows is still showing the error message

"Windows cannot access \\GAKS_1337_Router\WD_Red_8TB"

when I try to access the share.

so 0755 might not be the fix. I get the feeling it might be something in windows? I am going to try testing on another device.

I'm not entirely sure, but i know from the luci app you could specify a user for a share, though ive also seen situations people used root as default hence the log where samba warns there is no user 1000.

Its quite confusing :yum:

1 Like

Same thing if you try to access: \\ip_router? You could try enabling logging by entering the global configuration option 'log level = 5' then running 'tail -f /var/log/log.smbd' (if I'm remembering correctly).

You could try it because some permissions can also prevent from accessing a share, for my use case I also use 755 there since I had also issues.

So I would put "log level =5" in the "edit template" tab and running "tail - /var/log/log.smbd" in the ssh console?

1 Like