Software & Apps Linux How to Share Files and Folders Between Linux and Windows Samba makes it easier than you might think by Jack Wallen Writer Jack Wallen is a former Lifewire writer, an award-winning writer for TechRepublic and Linux.com, and the voice of The Android Expert. our editorial process LinkedIn Jack Wallen Updated on July 26, 2020 Linux Switching from Windows Tweet Share Email If your Linux machine is on a network, chances are you might want to share a directory (folder) or two to other users. Some Linux desktop environments (such as GNOME) make this incredibly simple. Some distributions and/or desktop environments, however, (such as Elementary OS) don’t offer a simple GUI for the sharing of folders. Should you happen to be using a desktop environment that doesn’t make the process of sharing directories to your network a simple point-and-click affair, you’re not out of luck. Thanks to Samba (the underlying technology that makes this happen), you can still share those directories. It’s a bit tricker, but it’s not terribly hard. What Is Samba? Samba is an open-source software that enables Linux-based systems to communicate with Windows and macOS systems via the Common Internet File System (CIFS). Samba gets its name from the Server Message Block (SMB) protocol, which is at the heart of CIFS. Without Samba, directories on Linux wouldn’t be visible to Windows or macOS machines on your network. For the purpose of this demonstration, we tested using Elementary OS 5 (Loki), which is based on Ubuntu Linux (so the process will be the same for any Ubuntu-based distribution) and Samba version 4.7.6. Installing Samba Chances are, you’re going to have to install Samba, as it is not included on most Linux desktop distributions. To install Samba, follow these steps: Open a terminal window from your desktop menu. Issue the command sudo apt install samb When prompted, type your user password. Allow the installation to complete. That’s all there is to the installation. Configuring Samba This is where things do get a bit challenging. What you must do is manually configure what are called Shares, with the Samba configuration file. In simple terms, a share is a directory you want to share with others on your network. We’ll create a very basic share. The first thing to do is back up the original Samba configuration file. To do this, open a terminal window and issue the command sudo cp -pf /etc/samba/smb.conf /etc/s With the original file backed up, it’s now safe to edit the original. Issue the command sudo nano /et and scroll to the very bottom of that file. What we’re going to do is add a new share for the Public folder, found in your user home directory. Let’s say your username is jack. The full path to that Public folder would be /home/jack/Public. That’s important to know. This new share will look like this: [Public]path = /home/jack/Publicbrowseable = yeswriteable = yesr Save and close that file by typing Ctrl + x. Finally, restart Samba with the command Adding Users Now we have to add our Linux users to Samba. Why? Because although the Linux system recognizes the users, Samba does not. One thing to understand is that anyone wanting to have access to those shared directories will need to have an account on your machine. You can create anonymous access to those shared folders, but it lacks security (and we want to keep our machines as secure as possible). Fortunately, there are only two simple commands to run. We’ll stick with our sample user, jack. The first command adds the user to Samba (requiring you type and verify a new password). This command is: sudo You might first be prompted for your users’ sudo password. Type that and then, when prompted, type and verify a new Samba password for the Samba user. The second command enables the user for Samba. This command is: sudo Ready for Access That’s it. The new user is added and will then be able to access the shares. If you go to another machine on your network, you should be able to access that share from your desktop’s file manager (with the username and password you configured using the smbpasswd command). How you access the share will depend upon the operating system and file manager used on the other machines.