dperson / samba

Samba docker container
GNU Affero General Public License v3.0
1.5k stars 509 forks source link

mount error(2): No such file or directory #449

Closed melardev closed 9 months ago

melardev commented 9 months ago

Hi, sorry for coming with a basic error, but I spent the whole morning on this and I hope you can help please. I want to use a SMB server for my environment, to start with I try the basic setup: run the container image, and try to mount it with mount command, still could not make it work:

docker run -it --name samba -p 139:139 -p 445:445 -e PERMISSIONS='0777' -v /mnt/samba:/smbshare -v /home/smb.conf:/app/smb.conf dperson/samba -u "admin;admin" -w WORKGROUP -s "share;/smbshare/;yes;no;no;all" -p -I /app/smb.conf

Contents of my smb.conf is just for troubleshoot:

[global]
log file = /var/log/samba/samba.log
log level = 10
max log size = 10000

Then I try to mount with:

mount -t cifs //localhost/smbshare/ /mnt/samba-mounted/ -o 'username=admin,password=admin,domain=WORKGROUP'

dmesg output:

[21672.969939] CIFS: VFS:  BAD_NETWORK_NAME: \\localhost\smbshare
[21672.970056] CIFS: VFS: cifs_mount failed w/return code = -2

The whole SMB logs:

Added user admin.
smbd version 4.12.2 started.
Copyright Andrew Tridgell and the Samba Team 1992-2020
adding IPC service
added interface eth0 ip=172.17.0.2 bcast=172.17.255.255 netmask=255.255.0.0
loaded services
INFO: Profiling support unavailable in this build.
Standard input is not a socket, assuming -D option
Becoming a daemon.
Registered MSG_REQ_POOL_USAGE
No builtin backend found, trying to load plugin
load_module_absolute_path: Module '/usr/lib/samba/pdb/tdbsam.so' loaded
pid_to_procid: messaging_dgm_get_unique failed: No such file or directory
Registered MSG_REQ_POOL_USAGE
Registered MSG_REQ_POOL_USAGE
tdb(/var/lib/samba/registry.tdb): tdb_open_ex: could not open file /var/lib/samba/registry.tdb: No such file or directory
Could not open tdb: No such file or directory
Failed to fetch domain sid for WORKGROUP
Initialise the svcctl registry keys if needed.
Initialise the eventlog registry keys if needed.
register_rpc_module: Successfully added RPC module 'mdssvc'
daemon_ready: daemon 'smbd' finished starting up and ready to serve connections
waiting for connections
Registered MSG_REQ_POOL_USAGE
Allowed connection from 172.17.0.1 (172.17.0.1)
init_oplocks: initializing messages.
Transaction 0 of length 236 (0 toread)
Selected protocol SMB3_11
GENSEC backend 'gssapi_spnego' registered
GENSEC backend 'gssapi_krb5' registered
GENSEC backend 'gssapi_krb5_sasl' registered
GENSEC backend 'spnego' registered
GENSEC backend 'schannel' registered
GENSEC backend 'naclrpc_as_system' registered
GENSEC backend 'sasl-EXTERNAL' registered
GENSEC backend 'ntlmssp' registered
GENSEC backend 'ntlmssp_resume_ccache' registered
GENSEC backend 'http_basic' registered
GENSEC backend 'http_ntlm' registered
GENSEC backend 'http_negotiate' registered
Got NTLMSSP neg_flags=0xe2088235
Got user=[admin] domain=[WORKGROUP] workstation=[laro] len1=0 len2=150
lp_load_ex: refreshing parameters
Initialising global parameters
Processing section "[global]"
Processing section "[share]"
Processing section "[global]"
adding IPC service
check_ntlm_password:  Checking password for unmapped user [WORKGROUP]\[admin]@[laro] with the new password interface
check_ntlm_password:  mapped user is: [WORKGROUP]\[admin]@[laro]
Forcing Primary Group to 'Domain Users' for admin
auth_check_ntlm_password: sam_ignoredomain authentication for user [admin] succeeded
Auth: [SMB2,(null)] user [WORKGROUP]\[admin] at [Wed, 18 Oct 2023 14:43:07.453196 UTC] with [NTLMv2] status [NT_STATUS_OK] workstation [laro] remote host [ipv4:172.17.0.1:56020] became [9F0934998281]\[admin] [S-1-5-21-2316414030-4043369180-2372878348-1000]. local host [ipv4:172.17.0.2:445] 
{"timestamp": "2023-10-18T14:43:07.453248+0000", "type": "Authentication", "Authentication": {"version": {"major": 1, "minor": 2}, "eventId": 4624, "logonId": "0", "logonType": 3, "status": "NT_STATUS_OK", "localAddress": "ipv4:172.17.0.2:445", "remoteAddress": "ipv4:172.17.0.1:56020", "serviceDescription": "SMB2", "authDescription": null, "clientDomain": "WORKGROUP", "clientAccount": "admin", "workstation": "laro", "becameAccount": "admin", "becameDomain": "9F0934998281", "becameSid": "S-1-5-21-2316414030-4043369180-2372878348-1000", "mappedAccount": "admin", "mappedDomain": "WORKGROUP", "netlogonComputer": null, "netlogonTrustAccount": null, "netlogonNegotiateFlags": "0x00000000", "netlogonSecureChannelType": 0, "netlogonTrustAccountSid": null, "passwordType": "NTLMv2", "duration": 810}}
check_ntlm_password:  authentication for user [admin] -> [admin] -> [admin] succeeded
Failed to fetch domain sid for WORKGROUP
NTLMSSP Sign/Seal - Initialising with flags:
Got NTLMSSP neg_flags=0xe2088235
Failed to fetch domain sid for WORKGROUP
Adding homes service for user 'admin' using home directory: '/home/admin'
Allowed connection from 172.17.0.1 (172.17.0.1)
idmap range not specified for domain '*'
Failed to fetch domain sid for WORKGROUP
Forced user smbuser
Forced group smb
make_connection_snum: Connect path is '/tmp' for service [IPC$]
Initialising default vfs hooks
Initialising custom vfs hooks from [/[Default VFS]/]
Initialising custom vfs hooks from [streams_xattr]
load_module_absolute_path: Module '/usr/lib/samba/vfs/streams_xattr.so' loaded
Initialising custom vfs hooks from [recycle]
load_module_absolute_path: Module '/usr/lib/samba/vfs/recycle.so' loaded
Initialising custom vfs hooks from [fruit]
load_module_absolute_path: Module '/usr/lib/samba/vfs/fruit.so' loaded
Initialising custom vfs hooks from [catia]
load_module_absolute_path: Module '/usr/lib/samba/vfs/catia.so' loaded
fruit_connect: Enabling durable handles for Time Machine support on [IPC$]
laro (ipv4:172.17.0.1:56020) connect to service IPC$ initially as user smbuser (uid=100, gid=101) (pid 44)
checking for home directory smbshare gave (NULL)
find_service() failed to find service smbshare
smbd_smb2_request_error_ex: smbd_smb2_request_error_ex: idx[1] status[NT_STATUS_NOT_FOUND] || at ../../source3/smbd/smb2_ioctl.c:312
checking for home directory smbshare gave (NULL)
find_service() failed to find service smbshare
smbd_smb2_tree_connect: couldn't find service smbshare
smbd_smb2_request_error_ex: smbd_smb2_request_error_ex: idx[1] status[NT_STATUS_BAD_NETWORK_NAME] || at ../../source3/smbd/smb2_tcon.c:142
laro (ipv4:172.17.0.1:56020) closed connection to service IPC$
Server exit (NT_STATUS_END_OF_FILE)
Could not find child 33 -- ignoring

With gio:

gio mount smb://localhost/
Authentication Required
Enter user and password for “localhost”:
User [laro]: admin
Domain [WORKGROUP]: WORKGROUP
Password: 
gio: smb://localhost/: Failed to retrieve share list from server: Invalid argument

Or with share:

gio mount smb://localhost/smbshare
Authentication Required
Enter user and password for share “smbshare” on “localhost”:
User [laro]: admin
Domain [WORKGROUP]: 
Password: 
gio: smb://localhost/smbshare/: Failed to mount Windows share: No such file or directory

The Errors of gio are also shown if trying to mount in nautilus, it asks credentials, when entered it says same errors.