Ubuntu and Windows can work together on a network of course, using winbind and samba. But Ubuntu doesn’t come that way and the configuration of Samba needs some work to make it happen.
I’ve got my systems all file sharing now, but it took some doing since I’m not a Samba expert.
It is a long and sorted tale taking about a week of posts on the Ubuntu forums with lots of missteps along the way, but I’ll cut to the final answer. If you really want to read the post in all it’s gory detail, go to the Very Strange Network Addresses post.
Caveat: I’m not a Linux expert and while I’ve used and coded IP applications for years, my commentary below may be flawed. If you see a mistake, let me know and I’ll be happy to correct it.
Start with Ping
After trying to fire up Samba and letting it go, it was a real mess. So when you do this it’s best to take it in stages.
Since modern Windows machines use file sharing over Tcp/Ip, we should get the machines talking with each other via Tcp first. I would have thought that Ubuntu would come Out of the Box [OOTB] that way, but it doesn’t.
I suggest you start by installing winbind and fixing up your /etc/nsswitch.conf file. Thanks to i_m_bobo for putting me on the right track here. My solution is similar, but not identical to his.
If you are new to installing packages, use System >> Administration >> Synaptic Package Manager and search for winbind. Set it to install and use apply. All new packages are installed this way.
I had to look around a bit to find out how to edit config files on Ubuntu. As you will quickly find, Ubuntu has a philosophy of a locked root account and uses sudo and gksudo commands to perform root command functions from your normal account. After using this a while, I quite like it.
Use sudo for command lines and gksudo for graphics commands. Look up these commands on the web for a full explanation, but here is how you edit your nsswitch.conf file:
darrell@squall-ubuntu:~$ cd /etc
darrell@squall-ubuntu:/etc$ gksudo gedit nsswitch.conf
The nsswitch.conf file I’m using looks like this:
darrell@squall-ubuntu:/etc$ more nsswitch.conf
# Example configuration of GNU Name Service Switch functionality.
# If you have the `glibc-doc-reference' and `info' packages installed, try:
# `info libc "Name Service Switch"' for information about this file.
hosts: files wins mdns4_minimal [NOTFOUND=return] dns mdns4
protocols: db files
services: db files
ethers: db files
rpc: db files
I added “wins” after files and before dns so that local host names would be resolved by wins if possible before using dns. Without winbind and this change, the host names were being resolved externally by dns, which is bound to give bad addresses.
After this change, you should be able to ping the rest of the windows boxes on your network, whether they are getting their IP addresses via DHCP or they are set to static addresses. I have both types on my network. It’s a good idea to test the pings both ways, of course.
Edit Your smb.conf File
I’m using WORKGROUP and not a domain solution.
Here are the changes that I’ve made:
- wins support = no for do not make this machine a wins server.
- Leave wins server commented out since we are not using wins in samba, but rather we are using winbind though dns.
- dns proxy = yes looks like another good thing to do since we are using dns and not wins or netbios to resolve addresses.
- Make sure that your name resolve order contains wins.
I would like to use security = user but my windows boxes refuse to connect to my Linux box with this setting. They prompt for a password, but apparently the Linux box does not accept the user / password. Not clear why. I have used encrypt passwords = false and no change.
Use System >> Administration >> Shared Folders to Create Shares
Once you have the machines connecting to each other, you can use System >> Administration >> Shared Folders to create shares. This program modifies smb.conf for you to add shares. Don’t mess with the Advanced tab tho since that may undo some of the above changes.
Apparently every time you make a change to the smb.conf file and save it, samba takes the new settings. No reboots required.
I hope this keeps some of you out of the weeds.
Update: Here’s the fix for security = user to work.
You need to add a password to the separate Samba password database. Use the following for each user and change security = share to security = user.
darrell@squall-ubuntu:/etc/samba$ sudo smbpasswd -a darrell
[sudo] password for darrell:
New SMB password:
Retype new SMB password: