9

The "file and printer sharing" feature of Linux distros is mostly Samba. Samba is an interpretation of Microsoft's network filesystem.

Cross-OS compatibility is important of course but why are Linux systems defaulting to this Microsoft technology?

Is Microsoft's network filesystem so good? Samba clearly works very well and I'm not "dissing" it.

Or, to rephrase the question, "What would be a Linux-native way to share files and printers across a network?"

Mark Henderson
  • 68,316
  • 31
  • 175
  • 255
Dougal
  • 297
  • 1
  • 5
  • 11
  • I've used Samba for quite awhile and I wouldn't say it works "well"... It works, but it's terribly slow, especially compared to NFS. I reserve Samba for cases where there's Windows boxen involved in the sharing needs. – Brian Knoblauch Apr 01 '10 at 19:57
  • Huh. I would tend to use CUPS pretty much exclusively for the printer sharing; I'd only involve Samba if 9x or NT <5 was involved, since 2000 and newer support IPP directly (just enter the printer URL when asked to enter the share path). – SamB Oct 29 '10 at 15:57
  • What you refer to as "Microsoft's network filesystem" (SMB) was written by IBM – symcbean Sep 23 '11 at 22:24

7 Answers7

11

The big 2 file sharing systems for Linux are NFS and SAMBA. We run both here for different reasons. Here is an off-the-top-of-my-head pro/con list

NFS

  • + Server-To-Server
  • + Fast
  • + Easy to set up for a small number of users
  • + Very dependable for clustering/High Availability
  • - Each client machine needs its own config in /etc/exports
  • - Very limited security options.
  • - Users must match on both server and client to preserve unix permissions
  • - Symlinks to content outside of the share will fail, or worse use a same-named resources on the client

SAMBA

  • + Server-To-User
  • + Very flexible configuration
  • + Ability to use per-user authentication against Active Directory, LDAP, local users, samba users
  • + Compatibility with most other OSs
  • + Ability to share printers
  • + Ability to save files with arbitrary permissions.
  • + Optionally supports full UNIX permissions
  • + Ability to make symlinks to resources outside of the share appear to be inside the share. For example to re-export a mounted share.
  • - Slightly higher overhead than NFS
  • - Flexible config is easy to screw up
  • - Caching/locking issues. If not all users are using samba to access the files, some users might not see changes to files
  • - Microsoft Issues. MS likes to "improve" the spec every few years, so future windows desktop client may not be able to connect to your Samba server. The Samba team is good about keeping up with MS, but you have to be aware of this
Mark Porter
  • 991
  • 1
  • 5
  • 12
  • 1
    /etc/exports supports cidr or netmask notation, so for the common case of exporting to a contiguous block there is no need to list every client explicitly. Also, wrt. the symlinking, see http://samba.org/samba/news/symlink_attack.html – janneb Apr 01 '10 at 20:11
  • Both good points. We either have "wide links" or "unix extentions" but not both. This goes back to the Samba being flexible and easy to screw up. Regarding the net mask in NFS, you are absolutely right. If you are comfortable giving access to machines you don't know about (like on a small managed private subnet) it can save a lot of effort. I work a university hospital, and we tend to treat even the intranet as an untrusted network. – Mark Porter Apr 02 '10 at 14:42
  • 1
    Actually, MS is pretty good about making sure Windows can use SMB shares from systems at least a couple of releases back, so it as long as Samba can keep up at least that well it shouldn't be a problem. A mess for the developers, true, but I think they can manage. (No, don't kill me, Jelmer! I wasn't suggesting they make things worse!) – SamB Oct 29 '10 at 16:02
10

Is Microsoft's network filesystem so good?

From the perspective that it is everywhere, then yes it is good. If you are asking if it is a good protocol, then the answer is that it isn't really all that great. It has large problems on links with high latency. It has far too many redundant commands. Microsoft has fixed a lot of this with SMB2.

Linux systems defaulting to this Microsoft technology?

There are lots of users who require that their Linux boxes be able to participate in a heterogeneous network. SMB is the lowest common denominator that seems to be supported on all common operating systems.

What would be a Linux-native way to share files and printers

NFS is probably the most standard *nix file sharing protocol.

LPR or CUPS is the most common Printing protocol.

Personally I strongly wish that webdav would become more common for file sharing. But I have yet to find a really good webdav daemon for *nix.

Dennis Williamson
  • 60,515
  • 14
  • 113
  • 148
Zoredache
  • 128,755
  • 40
  • 271
  • 413
  • 1
    I agree about WebDAV. I use it a lot through Apache, but it is definitely a second-class citizen on both the server and the desktop. – Mark Porter Apr 02 '10 at 14:44
8

Samba reached its prominence in large part because it allows unmodified Windows stations to talk to it, and since Windows is typically the largest population of Desktop users on any given network that makes it more interesting. The other population, Mac users, can use the not-well-maintained Netatalk package, or much more commonly the Samba package built into their OS. In short, Samba is da bomb because it works the best in heterogeneous networks.

The pure open-source file-serving solutions with unquestionable patent exposure out there are not that desktop-user friendly. NFS is pretty much it, which requires a root-mount and until very recently had very little in the way of built in security features. The FuseFS packages have gone a LONG way to making this a lot easier for desktop-linux users, as it allows things like SSH/SFTP to be a file serving protocol instead of a file sharing protocol; File -> Save -> Browse to location, will work with FuseFS.

sysadmin1138
  • 131,083
  • 18
  • 173
  • 296
2

Linux file sharing would be NFS and sharing printers would be CUPS. But there are many other file sharing as listed below like SSH, FTP, SFTP and so on.

xeon
  • 3,796
  • 17
  • 18
1

Protocols such as FTP, HTTP, NFS, and SSH. I typically only use SAMBA file sharing for conveniently transferring files between platforms.

Warner
  • 23,440
  • 2
  • 57
  • 69
1

There are also more linux-centric network file systems, but with clients for Windows avaiable: http://www.openafs.org/ and http://www.coda.cs.cmu.edu/

Hubert Kario
  • 6,351
  • 6
  • 33
  • 65
0

Standard UNIX file sharing is NFS. However, that is UNIX-only, as people have said. NFS also has some issues with mapping logins and so on. SAMBA implementations exist on lots of systems, and provide the widest connectivity options. Windows machines, Linux machines, and modern Macs can all use SAMBA. If you use that, you're pretty much guaranteed that other machines can connect.

mauvedeity
  • 166
  • 3
  • 1
    NFS is not unix only. You can install services for unix on a Windows box and access nfs, but the setup is a pain. – Zoredache Sep 23 '11 at 21:54
  • Yes, good point. I had forgotten about Services for Unix on Windows. However, isn't that servers only, and only for sharing - you can't connect to an NFS share with it as I recall. I should have explained more clearly. – mauvedeity Sep 24 '11 at 09:49
  • I have a win7 VM here, which connects to a linux based NFS share very easily. – dyasny Jul 31 '12 at 11:27
  • 1
    In case anyone wants to try Client for NFS on windows. http://technet.microsoft.com/en-us/library/cc754046.aspx – wanghq Dec 13 '12 at 20:08