How to make shares on Pi running Bookworm appear in Windows

Feb 05, 2024 Last reply: 2 years ago 20 Replies

Hello The!

05 Feb 24 12:43, you wrote to Jesper Kaas:

TP> On 05/02/2024 12:11, Jesper Kaas wrote: >> So how to either make shares in Pi visible in Windows, or opposite >> (or both ways)?

TP> Samba. sshfs.

NFSv4 would be a good choice

To do that make sure you have NFS Client (Services for NFS) installed from Programs and Features. Then mount the NFS drive using this cmd (not PowerShell) command

mount \<IP_ADDRESS>\<PATH_TO_DIR>\ drive:

Christian

Raspberrypi 5 running updated bookworm.



Moving files between Windows and Pi'es was easy with VNC, but VNC server is gone in Bookworm. Moving files between Windows and Pi *can* be done with SCP, but everytime I have to check how to write the command corretly. Bad memory.



Just to make it clear: My windows shares work fine between a Win11 PC, Win10 laptop and Android phone. Also when I was running Ubuntu, the Windows shares could be reached from Ubuntus filemanager.



So how to either make shares in Pi visible in Windows, or opposite (or both ways)? I have googled til I am blue in the face and tried umpteen recipies, but nothing works. Samba is installed on Pi, and smb.conf edited in a number of ways.



Off topic: The Pi 5 replaced a Pi 4 this friday, both 8 Gb. Just plugged the boot USB from the 4 to the 5. Big difference when web-browsing. With the Pi 4 you had to be a bit patient. The 5 feels almost like a PC.



My notes: This works for me and is well tested on bookworm. Hope there are clues for you there. It shares the root so you can see the lot.

sudo apt-get install samba samba-common-bin

sudo nano /etc/samba/smb.conf

In the [global] area make sure you have ;

workgroup = WORK GROUP

unix extensions = no

Comment out using # anything in [homes] even [homes] itself to prevent unwanted 'pi' share. eg.

#[homes] # comment = Home Directories # browseable = no # read only = yes # create mask = 0700 # directory mask = 0700 # valid users = %S

Then Print$ as that too shows a share on fileBrowser iPad.

#[print$] # comment = Printer Drivers # path = /var/lib/samba/printers # browseable = yes # read only = yes # guest ok = no

Then, just above [printers] in the share definitions... Add the following 14 lines...

--------------------------------------------------- # The following added to share the root.

[root] comment = root path = / writeable = yes only guest = no directory mask = 0777 create mask = 0777 force user = root force group = root public = no follow symlinks = yes wide links = yes

---------------------------------------------------

Save back the file Cntrl-X, Y, <ret>

Set the share password ======================

sudo smbpasswd -a pi enter password for pi user twice.

sudo systemctl restart smbd

'root' connection should now connect from a PC.

Done.

Samba. sshfs.

Well it always used to work. Maybe windows latest has made it harder to do. Remember to reload samba after configuration changes

If you don't need the full samba server, and are happy for a similar method to using VNC, then try winSCP on windows.

So anyone with the pi password can mount the share, after which anyone with access to the machine has root access to the filesystem on the pi. That's a little open for my tastes.

Fair enough, it's only a music player and there's only my wife and myself able to get at it so not concerned. However, there should be enough info there to get the OP going and from then on, he can make whatever more secure changes he needs/ wants.

Bob.

Tried to follow a recipe om phoenixNAP, but could not make it work. I will try Bob Lathams list.

Not all windows distros used to accept shares 'out of the box' Some needed tweaking.

Make sure smb and nmb daemons are running

Yes! That did it. With the above setup I, on the laptop, can see shares on the raspberrypi, and move files between windows and raspios. Pobabaly also works on the Win11 PC, but that is occupied at the moment,so can't test.

By the way: Before trying the above, I installed TigerVNC Server on raspberrypi. Then I could get the raspi up in RealVNC Viewer on the laptop. But there are no possibilities to transfer files. Some time ago I was working with PiZero's from RealVNC Viewer in Windows, and RealVNC had a button or something you could click to get up a menu for sending or fetching files plus other things. There is no such button in RealVNC now. Something missing in TigerVNC?

Thank you so much for all the help. Best regards.

You can test access access to the Samba server from a different Linux machine, or even the same Linux machine, using smbclient. That might help to diagnose some problems, by taking Windows completely out of the equation.

By the way, two config options that can affect the ability of Windows clients, particularly older Windows clients, to connect, are “server min protocol” and “ntlm auth”.

nmb is needed to implement NT4 domains. That’s supposed to be obsolescent, but the next step from that is Active Directory, and you probably don’t want to go there. So yeah, nmb it is.

Also I hear, once a Windows client has felt the hot breath of Active Directory on its network stack, it can never go back to NT4 domains.

If you are doing a lot of testing with enabling and disabling individual shares, an easy way to disable a share without having to comment the whole thing out is to add the setting “available = no”.

windbind is if you want your Linux logins to be controlled by a Windows server. Probably not recommended. cifs-utils is, again, another client- side thing, letting your Linux system mount volumes from a Windows server. Maybe useful for testing against your Samba server, otherwise unnecessary (see smbclient).

Aha. Thanks for the tip :-)

NMB seems to be running. "sudo service smbd status" gives this output:

  • nmbd.service - Samba NMB Daemon Loaded: loaded (/lib/systemd/system/nmbd.service; enabled; preset: enabled) Active: active (running) since Tue 2024-02-06 06:22:24 CET; 3h
16min ago Docs: man:nmbd(8) man:samba(7) man:smb.conf(5) Process: 1603 ExecCondition=/usr/share/samba/is-configured nmb (code=exited, status=0/SUCCESS) Main PID: 1678 (nmbd) Status: "nmbd: ready to serve connections..." Tasks: 2 (limit: 9250) CPU: 256ms CGroup: /system.slice/nmbd.service |-1678 /usr/sbin/nmbd --foreground --no-process-group `-1683 /usr/sbin/nmbd --foreground --no-process-group

feb. 06 06:22:23 raspberrypi systemd[1]: Starting nmbd.service - Samba NMB Daemon... feb. 06 06:22:24 raspberrypi systemd[1]: Started nmbd.service - Samba NMB Daemon. ~ Best regards

Thanks for that useful info. I'll add that to my notes.

Cheers,

Bob.

I think it is possible to go back.

A few years ago, I got the reasonable idea that I would like a single user identity for all file shares on my home LAN. So I decided to set up an ActiveDirectory type admin. I think I used OpenLDAP running on a rPi.

It was only after I “successfully” finished that I realised what it meant. A huge number of system admin tasks had to be done in an AD specific way. The smallest task became a mountain, for me at least. So I rolled it all back, I'm pretty sure I didn't need a full system install on all MS Windows clients, but can't be certain.

I still like the idea of a network wide user identity, primarily for file shares, but this early experiment has put me off further attempts to achieve it.

HAVE run into distros where the lack of winbind screws SAMBA. This is not a global issue however. Try it without winbind first.

Cifs-utils also adds the handy "-t cifs" option to 'mount'.

Note that I often wanted Winders boxes to mount shares on the Linux boxes and vice-versa. Office environments are usually "mixed" and, no, the boss is NOT gonna move the whole place over to Linux - more likely to all-Winders instead since bosses rarely understand IT stuff. I've encountered people who had to HIDE Linux boxes behind names like "winserver-B" until certain bosses moved on ... really !

Maybe you should diagnose the problem first, rather than guessing that “this package, which doesn’t do anything relevant, might fix the problem”.

Another tip: the default log file names for client connections can be a bit opaque. I like to set this option

log file = /var/log/samba/log.%I-%R

which puts the client IP address and the protocol version they are using into the log file name. Then you can narrow down the machines having trouble connecting, and have a guess as to why (“I didn’t know that box was still running Windows 7!”).

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required