For my setup I would like to create a Samba server that only allows access from certain IP addresses.
I used this configuration - you might notice I am a bit overwhelmed by the options and used keys from tutorials:
[global]
security=user
workgroup=TEST
map to guest = Bad User
# hosts allow = <allowed IP addresses> # will activate later, but want to have an open server running first
Debugging/Accounting
log file = /var/log/samba/log.%m
max log size = 1000
logging = file
[data]
comment= Public data
path = /home/x6/Documents/sharedFolder
read only = no
guest ok = yes
and changed the file permission of .../sharedFolder to 777:
drwxrwxrwx 2 x6 x6 4096 Jun 9 19:19 sharedFolder
Access attempts got logged in log.winhostname:
[2023/06/10 07:06:34.875024, 0, pid=1702, effective(65534, 65534), real(65534, 0)] ../../source3/smbd/service.c:168(chdir_current_service) chdir_current_service: vfs_ChDir(/home/x6/Documents/sharedFolder) failed: Permission denied. Current token: uid=65534, gid=65534, 1 groups: 65534
[2023/06/10 07:06:34.875064, 3, pid=1702, effective(65534, 65534), real(65534, 0), class=smb2] ../../source3/smbd/smb2_server.c:3954(smbd_smb2_request_error_ex) smbd_smb2_request_error_ex: smbd_smb2_request_error_ex: idx[1] status[NT_STATUS_ACCESS_DENIED] || at ../../source3/smbd/smb2_server.c:3246
I think that it's something with the user, but I am not that familiar with Samba yet. I tried following https://en.wikibooks.org/wiki/Samba/Configuring_a_Workgroup_from_the_Shell_with_Samba but the command smbpasswd -a guest wasn't "accepted" (just printed the smbpasswd help message again).
Additional information
What I have tried
I read a little bit into: https://www.samba.org/samba/docs/current/man-html/smb.conf.5.html#GUESTACCOUNT but it wasn't clear to me what to do.
I read this article, but it mentions the sudo smbpasswd -a name command that wasn't helpful in a tutorial before that one: https://www.ionos.de/digitalguide/server/konfiguration/samba-server-plattformuebergreifendes-netzwerk/
I tried this configuration here: https://wiki.samba.org/index.php/Setting_up_Samba_as_a_Standalone_Server but got the same error.
I tried accessing the samba server over smbclient both from the samba server computer and from a remote computer (running linux). While the general connection seems possible, because smbclient \\\\ip\\data results in a password prompt and then a smb:\ prompt where I can write additional commands, even simple commands like dir or ls fail with NT_STATUS_ACCESS_DENIED. Increasing the log level using -d didn't result in any valuable information - in my opinion. Logs are a bit too long to share.
My suspicion
Since configuration files from multiple tutorials have failed, I think it might be something outside of the configuration files, but I am unsure what might be the issue.
Later
Later I will use Windows Credential Manager to store the login information peristently Windows 10 forgets mapped drive's credentials after reboot
Regarding my setup
All computers are connected to a single router. Some are connected via WLAN others over LAN. A subset of these computers are "trusted" in the sense that they are allowed to access the folder. Therefore, I need to limit the access to those computers.
The router is assigning static ips to those computers. I think that's enough to prevent people from assigning themself a fitting IP and accessing the folder without being allowed to.