Software & Apps Linux How to Set Up Linux File Sharing With Samba Sharing files from the Linux desktop doesn’t have to be a challenge 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 January 20, 2020 Pixabay Linux Switching from Windows Tweet Share Email Linux was made to be on a network which is why it offers a high level of security and flexibility. If you happen to have multiple machines on a single network, then you might have a need to share out folders from your Linux desktop. Thanks to that inherent flexibility of the Linux operating system, this can be easily done, with the help of Samba. Samba is the Linux implementation of the Server Message Block (SMB) protocol, which is used for network file sharing. On the Windows operating system, this is simply referred to as SMB. Samba is free, open source software that is readily available for installation from within most standard repositories. Originally developed by Andrew Tridgell, Samba provides file and print services and can (as of Samba version 4) integrate with a Microsoft Windows Server domain (either as a Domain Controller or as a domain member). For some Linux desktop distributions, setting up Samba is a few quick clicks away from success. Before we examine how to set this up the easy way, let’s go the other route. We’ll be demonstrating by sharing files between Elementary OS and Ubuntu Desktop 18.04. It should be noted, that on the Ubuntu Desktop iteration of Linux, you won’t have to go through the manual process of installing Samba. Because this isn’t the case for every Linux desktop, let’s install. Log into your Linux desktop and open a terminal window. Update and upgrade with the command: sudo apt-get update && sudo apt-get upgrade -y When the upgrade completes reboot the desktop (which is only necessary if the kernel is upgraded). Install Samba with the command: sudo apt-get install samba -y Start and enable Samba with the commands: sudo systemctl start smbdsudo syst Samba is now ready to be configured. Samba isn’t all that difficult to configure. When using GNOME on Ubuntu Desktop, you won’t have to bother with manually configuring Samba, via a configuration file. However, on Elementary OS (and other distributions), it is required to configure Samba from a text-based configuration file. Here’s how: Open a terminal window on your desktop. Issue the command: sudo nano /etc/samba/smb.conf Locate the line workgroup = WORKGROUP and change it to something unique (or, if you already have a workgroup on your network, change it to that). Below the workgroup line, add the line netbios name = NAME (Where NAME is the name, or hostname, of your desktop computer). Let’s say you want to share the Documents folder in your home directory (we’ll call that /home/jack/Documents, such that those using the share can create new folders and files. At the bottom of the smb.conf file, add the following: comment = NAME Documents path = /home/jack/Documents writeable = yes browseable = yes guest ok = yes creat Where NAME is the same name you used for the netbios option. Save and close the smb.conf file. Next you need to add your user to Samba. This is done with the following two commands: sudo smbpasswd -a $USERNAMEsudo smbpa You will first be prompted for your sudo password and then to type and verify a new SMB password for the user. Options Explained In the above commands, the -a option adds the user and the -e option enables the user. Finally, restart Samba with the command sudo systemctl restart smbd. Adding More Shares If you want to add more than just one share, create the new one below the [Documents] share, using that same configuration model. You should now be able to connect to the newly created Samba share from any Desktop file manager on your network, that supports the SMB protocol (which is most of them). How this is done, will depend upon the operating system connecting to the Samba share and the file manager used. If Ubuntu Desktop is your distribution of choice, creating a Samba share is much easier. We’ll share the same directory (/home/jack/Documents). To do this, follow these steps: Open the file manager. Right-click the Documents folder and click Local Network Share from the menu. In the resulting window, select the check box for Share this folder and then check the check boxes for Allow others to create and delete files in this folder and Guest access. Type a descriptive comment in the Comment section (optional). Press Create Share. When prompted, press Add the permissions automatically. You should now be able to access /home/jack/Documents from any desktop file manager on your network.