Here are some notes about my experience sharing files from Linux so that my Windows 10 computer could access them. I’m going to try to make this useful but not give excessive details. It’s already going to be long!
The technology I used to share the files is called Samba. It uses the SMB networking protocol. According to wikipedia.org, the Samba name was chosen because it has the letters ‘S’, ‘M’ and ‘B’ in the same order as SMB.
These comments are about “second day” issues. I shared successfully on the “first day” by following tutorials. However, I forgot what was important. I couldn’t access the Linux computer when I turned the computers back on the next morning.
I’m using Ubuntu 18.10 and Windows 10. Other flavors of Linux may use different commands, but the principles should be the same. Other flavors of Windows might work in the Windows 10 manner, but I didn’t try.
-
On the Windows side, I want to connect to the Linux computer’s name, not its IP address.
\\192.168.1.5\Documents
bad.
\\Sesqui412\Documents
good.The IP address changes easily. The tutorials use an IP address, but that’s not the second day solution.
I can also use
net use L: \\Sesqui412\Documents
to access the files asL:
. -
I don’t need the ‘
samba
‘ service running on Linux. I want the ‘smbd
‘ service. This was a big rabbit hole. Once I gave up on the “samba” service and started using the “smbd” service, it worked correctly on the Linux side. I didn’t see any message online “Hey! you don’t want the samba service, you want smbd.” That would have been appreciated.
This whole effort may have been completely unnecessary. if I had started with the smbd service instead of the samba service, I might have seen that everything was already correct from yesterday.
This was a big battle. I was looking for information about starting samba. When I installed Samba
sudo apt-get install samba
I would get an error message
"Samba is not being run as an AD Domain Controller: Masking samba-ad-dc.service"
.However, I didn’t notice the message right away. Reinstalling Samba with
sudo apt-get install samba --reinstall
let me eventually see the error. Trying to fix the message led me to a lot of grief and DuckDuckGo searches.There is a lot of information on serverfault.com and askubuntu.com about Samba problems. I found the basic commands to use are
sudo systemctl enable smbd
sudo systemctl start smbd
To check for error messages, usesudo systemctl status smbd
. Some references also suggest startingnmbd
. I didn’t verify thatnmbd
is necessary but I used it.Again, to emphasize, this whole section is probably unnecessary. It was certainly “educational.”
-
I didn’t need to manipulate file permissions on the Linux computer. I didn’t manipulate any file permissions and they weren’t necessary to make the share work. Some online helps make
chmod
suggestions about that but I could safely ignore them.
- Yesterday, I set up the configuration file /etc/samba/smb.conf. It was pretty straightforward. Network Administration: Samba smb.conf file describes options in the file. There’s also help at How to set up quick and easy file sharing with Samba.
Some tutorials explain that when you change smb.conf, you need to run
sudo systemctl restart smbd
to activate the changes - If you find a tutorial site that gives a long story without explaining their purpose, try to understand the situation, not throw attempts on the wall and hoping they stick. (Disclaimer: This post isn’t meant as a tutorial, but rather some observations. For example, I don’t say anything about how I did the “first day”.)
Two help sites that I feel are worth avoiding are http://social.microsoft.com/forums and http://ubuntuforums.org. If I see a link to either of them in a search result, I should keep looking somewhere else. Other resources are likely to have more “signal” and less “noise.”
The three http://serverdefault.com, http://askubuntu.com and http://superuser.com are communities that are more likely to have reliable information.
- The passwords for Samba use the program
smbpasswd
on the Linux computer. I had trouble with the passwords. This was the command to fix it. I’m not sure exactly what I did. I might have just used the wrong password.
So, on the first day, I got it working. On the second day, it broke. It was a lot of work fixing it. I hope these notes help someone else know some of the principles so that they can have a happier second day than I did!