Samba File Sharing Over Our Home Network

I use an ancient Raspberry Pi Model B single-board computer as a way to share files across our home network. I use the network sharing service Samba to make a folder on the Pi available to any machine that cares to access it. It’s an easy way to make files from the upstairs computer available to everyone else, or to let my wife make her home office files available to her laptop in the living room.

Samba took me a couple of hours to configure one afternoon as I worked through a couple of tutorials. Sine then it’s been fairly bulletproof … on the few occasions we have lost power the Pi goes dead (as it will with no power), but once the power comes back on, the Pi would restart itself and go back to sharing its shared files, no user intervention required.

Until recently, that is.

I never bothered to troubleshoot it, but the Raspberry Pi started becoming inaccessible. It would buzz along for a couple of days, then either the shared folder would disappear, or it would be listed but access would be denied, or I couldn’t SSH to the Pi or ping it at all. I’d go upstairs, power cycle it, and it would restart itself and be fine for another 36 hours or so.

I wound up giving it a new SD card and a new installation of Raspbian 11 (Bullseye). That was maybe 4 weeks ago. Since then, it’s been back to being bulletproof – its Shares folder answers every time I check it. (Except in Windows 11, but that’s a whole separate troubleshooting, and I expect, firewall tweaking issue.)

Here’s the simple configuration that seems to have set the access to the shared folder aright. This configuration lives in the file, \etc\samba\smb.conf

[global]
workgroup = WORKGROUP
server role = standalone server
map to guest = Bad User
usershare allow guests = yes
hosts allow = <redacted>
hosts deny = 0.0.0.0/0

[shares]
comment = shared folder
path = /home/<redacted>
read only = no
guest ok = yes
force create mode = 0755
force user = <redacted>
force group = <redacted>

The ‘<redacted>’ lines are just my attempt to keep a modicum of privacy and network security. The ‘hosts allow’ entry is a range of IP address on my network that are allowed access to the shares, and ‘force user’ and ‘force group’ are a username or a user with full access (SUDO access) to the Pi.

Oh, be warned … this configuration will allow any user with access create AND DELETE files and folders. My wife and I are both savvy enough to be careful with that sort of thing, but this does allow any user to monkey with any of the files, or all of them.

I’ll be troubleshooting the Windows 11 access issues soon, and I’ll try to report if I get the Windows 11 client working any better.

Hello!

Hello!

Welcome to my site!

My name is John, I’m a fiftysomething IT Technician living and working in southern California. My main interests are music, computer tinkering, car culture, and gaming.

Have a look around my site, if you like. I hope you can find something to interest you.

Feel free to drop me a line at john at john lantier dot net and let me know what you think of my site.

Thanks for stopping by!

John
22 December 2024