7 ms·
Samba on Linux the Easy Way
- RockRobotRock 4y agoI appreciate the quirky writing
- whateveracct 4y agoI love NixOS for this. It's a few lines of Nix config to set up samba sharing for a directory + a .local domain for discoverability.
- xrd 4y agoCan you share a link?
- bpye 4y agoThis is my Samba config https://gist.github.com/benpye/34b3a788d90c259528885943029d08f7 https://gist.github.com/benpye/34b3a788d90c259528885943029d0... . I've also got it configured so that ZFS snapshots are visible in file history. I use this most for storing my Lightroom catalogue, and then have B2 backups setup from the home server as well.
- mbreese 4y agoIt’s an entertaining way of writing, but please don’t do any of the port forwarding stuff mentioned towards the end. I can’t imagine any scenario where I’d want to have a Samba share exposed to the internet. If you need remote access to a local shared folder, use a VPN. Now the same person should write a “wireguard on Linux — the easy way”. (Which would probably be — use tailscale)
- deleted 4y ago[deleted]
- flas9sd 4y agothe author warns to not forward to the internet. I guess there are homerouters out there isolating each client. I agree that wireguard is the way. Besides tailscale, a bit of config autogeneration goes a long way there - easy-wg-quick and friends
- loxias 4y agoEntertaining writing, but also a bunch of fluff I don't see the point of? It's not like setting up a share is hard, I'm missing the point of why something that's already easy would need an "easy way". Now, Samba as an AD DC, across multiple sites, integrating with Kerberos and LDAP, so that users can have a single sign on experience across platforms... That, I'd be impressed at an "easy way" guide. ;-) I think I'm not the target audience.
- vetinari 4y agoMaybe I'm weird, but what's difficult with Samba as an AD DC, with multiple sites or trusts? It seems easy to me, all you need to know is on the samba wiki. The biggest "problem" is that distros do not ship Samba packages with DC support, you either have to use 3rd-party build like Tranquil's or build your own.
- loxias 4y agoYou're probably right, AND, I'm speaking about doing this ~a decade ago. I expect things have improved, but if I recall correctly, the challenge was all the integration with external systems (krb5, LDAP, print stuff). Took more than a month, but was a thing of beauty to have windows and linux desktops, where you type your password _once_, and then everything just works, and you have the same experience regardless of computer. For some reason I remember spending a lot of time on getting the printing to be one click working... shrug I guess my only point was that samba for just sharing files is already super easy, so I don't get what an "easy way" is for. :) You might be saying "but hard things are easy too", implying that you're more experienced than me at samba and/or the software itself has improved. I wouldn't be surprised if both were true.
- tinus_hn 4y agoThere is a nasty, confusing mix of Heimdal and MIT Kerberos tools, bind and Samba internal dns, winbindd and sssd, the realm command and the net command and the samba-tool command and a million outdated howtos in between, fighting with tools that are editing configuration under you. And no standardized management tool, LDAP with its text based but unusable interface and different, opaque ways of storing machine credentials. Creating a domain on a Samba domain controller is not too difficult if you follow the documents. But choosing the right way to join a client to the domain and then using SPNs? Synchronized uids? User management? I haven’t found it to be easy at all.
- johnchristopher 4y agoI have given up on Samba on my home network. It's just 2 pi, 2 laptops but client randomly loses connection to folders or dolphin/nautilus stop seeing folders, hit refresh, there it is again, etc. I just use sshfs and I am done with it. I just want to easily move files around my network and samba took too many hours of my life to look at what's wrong this year with client version or spaces in shared folders. It's always something.
- legal_penguin 4y agoI took the time to debug all the Samba issues between my Pis and Linux + Windows desktop computers. Most of the time there are two separate problems: 1. Samba share is not discovered in the network. All my problems were gone after installing wsdd2. 2. Permissions. Especially Windows clients implicitly try to login with an empty password to check if the share can accessed without one. This can lead to problems with the "map to guest" directive in the Samba configuration. Also the Windows credential storage sometimes saves passwords that did not work and implicitly tries to login. But don't get me started on the Gnome/gvfs client implementation of Samba. I have given up on that. - https://bugs.launchpad.net/gvfs/+bug/1828107 https://bugs.launchpad.net/gvfs/+bug/1828107 - https://gitlab.gnome.org/GNOME/gvfs/-/issues/307 https://gitlab.gnome.org/GNOME/gvfs/-/issues/307 I put together a small writeup in case someone wants to take a deep-dive: https://blog.hiebl.cc/posts/why-your-samba-config-does-not-work/ https://blog.hiebl.cc/posts/why-your-samba-config-does-not-w...
- vetinari 4y ago(reacting to your writeup) - gvfs might not support ws-discovery for smb discovery, but neither does macos. They both support dns-sd/bonjour/zeroconf for that; so getting up avahi up and running with advertising the smb service is the easiest way to handle both. Synology does this OOB, for example. - gvfs is not an implementation of samba. It is a frontend to libsmbclient library from the samba package. Unfortunately, libsmbclient does read smb.conf and adjusts itself accordingly, without the consumers of the library having a say in it. The best way to debug gvfs problems is to start with empty smb.conf.
- 4y ago
- kabes 4y agoSo. I don't know if it's a samba thing, an ubuntu thing, a gnome thing, or yet another thing. But accessing smb folders with a large amount of files is waaaay slower with Ubuntu than with windows. Also: will we ever get thumbnails?
- iguessthislldo 4y agoIsn't there a setting in nautilus for the thumbnails? I can't test it at the moment unfortunately as my server's SSD died recently and I haven't set up samba again. I remember it working, but being slow depending on the type of file. I guessed at the time some files seemed to need to read the entire file first.
- yeuxardents 4y agoTheres a really good rant/writeup about thumbnails and gnome/linux. https://randthoughts.github.io/little-rant-about-gnomes-file-manager-aka-nautilus/ https://randthoughts.github.io/little-rant-about-gnomes-file...
- squarefoot 4y agoIt could very likely be Gnome. I would try accessing the same smb folders using a different desktop environment and file manager (eg. Thunar under XFCE, etc). The fastest one I'm aware of out there is Rox Filer which is already available on many distros and can be used in place of the stock one, but as far as I can tell it doesn't know anything about network shares, that is, it won't mount the share when the relevant mount point is accessed, the user has to provide an already mounted directory or implement automount. That's the price to pay for something that is like orders of magnitude faster than most used file managers. https://github.com/rox-desktop/rox-filer https://github.com/rox-desktop/rox-filer
- KronisLV 4y agoPersonally, I think that SFTP can be a decent option. Though on Windows hosts that want to access said files, I've found myself needing something like RaiDrive or a similar piece of software: https://www.raidrive.com/ https://www.raidrive.com/ That said, the performance is pretty good and it seems rather stable, I haven't had many issues to date at all. Though my use case is also decidedly simple: just a "push" setup for files/backups when I want to move things from one of my local HDDs to another one that's running on a homelab server. Some might go for a NAS setup, though the simplicity of a SSH key for SFTP is hard to beat. No idea why Windows doesn't support something like that natively.
- trelane 4y ago> No idea why Windows doesn't support something like that natively I think the answer is right at hand. Or maybe I'm just too cynical.
- vardump 4y agoI'd be happy to get Samba and macOS working together that way macOS doesn't disconnect mounted drives a few times per hour.
- dade_ 4y agoOnce I figured it out, over 20 years ago, I’ve found it trivial since. Though not as simple as sharing on Windows. A friend of mine has been trying to learning Linux this month, and he came to me frustrated, losing his mind. A whole day going all over the place on the Internet, obviously following tutorials he didn’t understand, and installing who knows what, and I asked, did you install SAMBA? He asked, what’s that? However the package was installed and I explained smb.conf file and SMB user. The problem is people are lazy and don’t want to look stupid. So they will spend days searching the web, reading through the endless ‘blind leading the blind’ user forums (Ubuntu comes to mind), instead of RTFM. And won’t ask someone for help until they have wrapped their brain into a frustrated knot.
- blooalien 4y agoAbsolutely seen this on more than one occasion. Makes me glad that I was fortunate enough to have had a really exceptionally awesome early grade-school teacher instill in us the statement that "the only truly stupid question is the one you don't ask when you really need an answer".
- azalemeth 4y agoThe other thing that is worth saying is that TFM of RTFM fame is usually really quite good, but also really quite large. I read all of nmap's documentation as a teenager and learnt a lot about networking. I'm sure 99% of the time all I need is -sS -O, and sometimes -P, but I'm very happy with the knowledge/time rato. It's a wonderful, huge tool and I know that if I need to use a bit more functionality I can do do. A lot of the shitty guides do the equivalent of saying "nmap? Just run sudo nmap -sS HOSTNAME to do a port scan!", but spread out across ten pages of SEO crap. It's not exactly wrong, but it's not exactly helpful either. The trouble is, of course, that now if you Google "how to do a port scan Linux" you get that guide, rather than the manual that explains in detail why it's a hard problem and a bunch of ways and subtleties about doing it. Fast forward ten years and anything other than -sS looks weird. Samba is the same, but somehow, infinitely more complex in detail and, because the tools have different names, less searchable. Want to mount and active directory share? You probably need kinit and to know the word "Kerberos". Browse other shares? Smbtree. Make them persistent together and mount on boot? That's another silly, overly detailed guide. And each one of these guides comes with its own lack of detailed understanding by the authors, focus on ads and SEO, and further obscures the fact that the original FM covers all of this in detail, but it's long and complicated, because, well, it's complicated! I personally think that open source projects would do well to maintain a cookbook FAQ of "here is a set of common usages of this tool". Many man pages do, with one liners, but anything more complex tends to be hidden. It would be great if those who understand the complex subtleties involved write a definitive way to do things, rather than expecting everyone to read all of TFM all the time -- and I equally realise that, as someone who makes complex software to do complex things, half the time you really would rather your users RTFM you spent so long writing at any rate...
- unixhero 4y agoOne ought to use SFTP / SCP / SSHFS for local and remote file sharing anyway.
- poxwole 4y agoWhy not just use sshfs?
- xmodem 4y agoA related point is that I recently discovered that, with the right incantations in the config file, macOS clients to a samba server can store their metadata in filesystem extended attributes, preventing them from vomiting dotfiles all over your share.
- rawoke083600 4y agoGood guide :) Brings back memories of horror and achievement from my PFY-Geeks-Days while "chanting" smb.conf files and clicking on Network Neighbourhood (hoping against all hope) ! #goodtimes :)
- jftuga 4y agoI wrote a quick gist on setting up Samba on Fedora and Raspberry Pi: https://gist.github.com/jftuga/8046ad3119d24690f5db2eb8992dfa4f https://gist.github.com/jftuga/8046ad3119d24690f5db2eb8992df... I use this for mapping my $HOME directory onto a Windows computer.