The NT_STATUS_BAD_NETWORK_NAME error typically occurs when Samba cannot resolve the requested share name during connection establishment. In your case, it manifests specifically during guest access attempts while regular authenticated access works.
Your current configuration has several relevant parameters:
[global]
security = user
map to guest = Bad Password
usershare allow guests = yes
[vms]
path = /home/neil/VirtualBox/HardDisks
guest ok = yes
read only = yes
The issue likely stems from one of these scenarios:
- Guest account mapping failure in the Samba user database
- Missing or incorrect permissions on the shared directory
- Conflict between global and share-level guest access settings
Try this modified configuration with explicit guest account specification:
[global]
security = user
map to guest = Bad User
guest account = nobody
usershare allow guests = yes
[vms]
path = /home/neil/VirtualBox/HardDisks
guest ok = yes
read only = yes
force user = nobody
Test the configuration with these diagnostic commands:
# Verify guest account existence
sudo pdbedit -L | grep nobody
# Check directory permissions
ls -ld /home/neil/VirtualBox/HardDisks
# Alternative connection test
smbclient //localhost/vms -N
Enable debug logging in smb.conf to identify the exact failure point:
[global]
log level = 3
log file = /var/log/samba/log.%m
Then monitor the logs in real-time:
tail -f /var/log/samba/log.neil-ubuntu
When enabling guest access:
- Ensure the guest account has minimal filesystem permissions
- Consider IP-based access restrictions if needed
- Regularly audit access logs for suspicious activity
If guest access isn't mandatory, consider using anonymous authentication instead:
[vms]
path = /home/neil/VirtualBox/HardDisks
public = yes
read only = yes
browseable = yes
When configuring Samba shares, one common error developers encounter is NT_STATUS_BAD_NETWORK_NAME
during guest access attempts. This typically indicates one of several potential configuration problems in your smb.conf
.
Your current setup shows a valid share configuration for authenticated users:
[vms]
comment = VirtualBox Virtual Machines
path = /home/neil/VirtualBox/HardDisks
guest ok = yes
read only = yes
While this works for authenticated users (-U neil
), guest access fails despite having guest ok = yes
.
For proper guest access in Samba, several parameters must work together:
[global]
security = user
map to guest = Bad Password
guest account = nobody
usershare allow guests = yes
The critical missing element is the guest account
parameter. Without this, Samba doesn't know which system account to use for guest access. Add this to your [global]
section:
guest account = nobody
Even with correct Samba configuration, the underlying file system must allow access:
$ sudo chmod -R 755 /home/neil/VirtualBox/HardDisks
$ sudo chown -R nobody:nogroup /home/neil/VirtualBox/HardDisks
Here's the full working configuration for guest access:
[global]
security = user
map to guest = Bad Password
guest account = nobody
usershare allow guests = yes
[vms]
comment = VirtualBox Virtual Machines
path = /home/neil/VirtualBox/HardDisks
guest ok = yes
read only = yes
browseable = yes
After making these changes and restarting Samba (sudo service smbd restart
), test with:
$ smbclient //neil-ubuntu/vms -U guest%
The %
after guest tells smbclient to send an empty password.
Samba's NT_STATUS_BAD_NETWORK_NAME
often masks permission issues because it's the Windows-compatible error code for various share access problems. For better debugging, enable detailed logging:
[global]
log level = 2
log file = /var/log/samba/log.%m