Ubuntu Server 18.04 – File server considerations

How to Change the server name on Windows Server 2019

There are two common technologies you can utilize to share files with your users, Samba and NFS. In fact, there’s nothing stopping you from hosting both Samba and NFS shares on a single server. However, each of the two popular solutions is valid for particular use cases. Before we get started with setting up our file server, we should first understand the differences between Samba and NFS, so we can make an informed decision as to which one is more appropriate for our environment. As a general rule of thumb, Samba is great for mixed environments (where you have Windows as well as Linux clients), and NFS is more appropriate for use in Linux or UNIX environments, but there’s a bit more to it than that.

Samba is a great solution for many environments, because it allows you to share files with Windows, Linux, and macOS machines. Basically, pretty much everyone will be able to access your shares, provided you give them permission to do so. The reason this works is because Samba is a re-implementation of the Server Message Block (SMB) protocol, which is primarily used by Windows systems. However, you don’t need to use the Windows platform in order to be able to access Samba shares, since many platforms offer support for this protocol. Even Android phones are able to access Samba file shares with the appropriate app, as well as other platforms.

You may be wondering why I am going to cover two different solutions in this chapter. After all, if Samba shares can be accessed by pretty much everything and everyone, why bother with anything else? Even with Samba’s many strengths, there are also weaknesses as well. First of all, permissions are handled very differently, so you’ll need to configure your shares in specific ways in order to prevent access to users that shouldn’t be able to see confidential data. With NFS, full support of standard UNIX permissions is provided, so you’ll only need to be able to configure your permissions once. If permissions and confidentiality are important to you, you may want to look closer at NFS.

That’s not to say that Windows systems cannot access NFS shares, because some versions actually can. By default, no version of Windows supports NFS outright, but some editions offer a plugin you can install that enables this support. The name of the NFS plugin in Windows has changed from one version to another (such as Services for UNIX, Subsystem for UNIX-based Applications, NFS Client, and most recently, Windows Subsystem for Linux) but the idea is the same. You’ll need to enable a specific plugin for your version of Windows in order to access NFS shares. The problem is that historically Microsoft has limited access to these tools to only the more expensive Windows editions, such as Ultimate and Enterprise when it comes to Windows 7, and Enterprise when it comes to Windows 8. Thankfully though, Microsoft came to their senses a bit and have allowed the Linux Subsystem to be installed on any version of Windows 10, so this licensing restriction only comes into play on older versions. Depending on how many legacy Windows machines exist in your environment that need to access NFS shares, this could be a significant licensing cost to your organization. This is yet another reason why Samba is a great choice when you’re dealing with the Windows platform; you can circumvent the cost of upgraded licenses, since even home editions of legacy versions of Windows can access Samba shares.

In regards to an all-Linux environment or in a situation where you only have Linux machines that need to access your shares, NFS is a great choice because its integration is much tighter with the rest of the distribution. Permissions can be more easily enforced and, depending on your hardware, performance may be higher. The specifics of your computing environment will ultimately make your decision for you. Perhaps you’ll choose Samba for your mixed environment, or NFS for your all-Linux environment. Maybe you’ll even set up both NFS and Samba, having shares available for each platform. My recommendation is to learn and practice both, since you’ll use both solutions at one point or another during your career anyway.

Before you continue on to read the sections on setting up Samba and NFS, I recommend you first decide where in your filesystem you’d like to act as a parent directory for your file shares. This isn’t actually required, but I think it makes for better organization. There is no one right place to store your shares, but personally I like to create a /shared directory at the root filesystem and create sub-directories for my network shares within it. For example, I can create /shared/documents, /shared/public, and so on for Samba shares. With regards to NFS, I usually create shared directories within /exports. You can choose how to set up your directory structure. As you read the remainder of this chapter, make sure to change my example paths to match yours if you use a different style.

Comments are closed.