Samba服务器无法运行求助:Ubuntu 14.04LTS部署的服务Windows10无法访问
Hey there, let’s work through this Samba access issue together—this is super common between Ubuntu 14.04 LTS and Windows 10, so let’s break down the troubleshooting steps one by one:
Start with the fundamentals—if the network isn’t working, nothing else will:
- On your Windows 10 machine, ping your Ubuntu server’s IP address. If it fails, fix network issues first (check firewall rules, router settings, or cable connections).
- Test if Samba ports are open: Use
telnet <your-ubuntu-ip> 139andtelnet <your-ubuntu-ip> 445in Windows Command Prompt. If connections are refused, open these ports on Ubuntu’s UFW firewall:sudo ufw allow 139/tcp sudo ufw allow 445/tcp sudo ufw reload
Let’s check for common misconfigurations in your smb.conf (usually at /etc/samba/smb.conf):
- In the
[global]section, make sure these settings match your Windows environment:workgroup = WORKGROUP # *Must match your Windows 10 workgroup* (default is WORKGROUP) netbios name = UBUNTU-SERVER # A simple, easy-to-identify name for your server security = user # This is the most compatible mode for Windows 10 map to guest = Bad User name resolve order = bcast host lmhosts wins - For your shared directory section (e.g.,
[my-share]), ensure:path = /path/to/your/shared/folder browseable = yes read only = no guest ok = yes # Set to "no" if you want to restrict to specific users create mask = 0777 directory mask = 0777 - Test if your config is valid: Run
testparmin Ubuntu terminal. It’ll flag any syntax errors—fix these before proceeding. - Restart Samba services to apply changes:
sudo service smbd restart sudo service nmbd restart
Samba can’t access folders if the OS permissions are too strict:
- Grant temporary full access to your shared folder for testing:
sudo chmod -R 777 /path/to/your/shared/folder - Adjust ownership if needed:
- For guest access:
sudo chown -R nobody:nogroup /path/to/your/shared/folder - For specific user access:
sudo chown -R your-ubuntu-username:your-group /path/to/your/shared/folder
- For guest access:
Windows 10 has default settings that can block older Samba versions:
- Match Workgroups: Right-click "This PC" → Properties → Change settings → Change. Ensure the workgroup name matches the
workgroupvalue in your Samba config. - Enable SMB 1.0: Ubuntu 14.04’s Samba version is older, and Win10 disables SMB 1.0 by default. Go to Control Panel → Programs → Turn Windows features on or off → Check "SMB 1.0/CIFS File Sharing Support" → Restart your PC.
- Access via IP Address: Instead of using the server name, type
\\<your-ubuntu-ip>in Windows File Explorer’s address bar. This avoids NetBIOS name resolution issues. - Clear Stored Credentials: If you entered a wrong password before, Windows caches it. Go to Control Panel → User Accounts → Credential Manager → Windows Credentials → Delete any entries for your Ubuntu server, then try accessing again.
- Temporarily Disable Windows Firewall: If access works after disabling it, add a rule to allow SMB traffic through the firewall.
If your security = user in the config, you need to create a Samba user linked to an existing Ubuntu user:
sudo smbpasswd -a your-ubuntu-username
Set a password when prompted—you’ll use this username/password when accessing the share from Windows 10.
If none of these steps work, share the output of testparm and any error messages from /var/log/samba/smbd.log, and I’ll help dig deeper!
内容的提问来源于stack exchange,提问作者Tudor Hutu

