Samba is a key component of using Linux in a business environment. With this subsystem, users can share directories across the network so others can view and even edit the contents within.
SEE: 40+ open source and Linux terms you need to know (TechRepublic Premium)
With some Linux distributions, such as Ubuntu Desktop, many of the pieces are in place by default. Other distributions, such as those based on Red Hat Enterprise Linux, might not include everything required to get Samba working out of the box. That’s what I’m here for: I want to walk you through the process of getting Samba up and running on RHEL-based Linux distributions.
What you’ll need to get Samba running on RHEL-based distributions
The only things you’ll need to get Samba installed are a RHEL-based Linux distribution and a user with sudo privileges. I’ll demonstrate with EuroLinux, but this process should work with just about any RHEL-based distribution.
How to install Samba
The first thing we must do is install Samba. For this, log in to your Linux distribution and open a terminal. From the terminal window, issue the command:
At this point, the Samba share should be accessible from other machines on your network. And with the smb.conf Public configuration, even anonymous users have both read and write access to the share.
How to limit access to registered users
If you don’t want such wide access granted to the share, you can set it up such that only legitimate users can access the share. The one caveat to this is that the user will have to have an account on your machine. Of course, you could always create a sambashare user, so you only need to give out the credentials for that user. To create the sambashare user, issue the command:
sudo adduser sambashare
Make sure to give the user a strong/unique password.
Next, give the new user a samba password with:
sudo smbpasswd -a sambashare
Next, enable the user with:
sudo smbpasswd -e sambashare
Next, the smb.conf Public entry should look like this:
[Public] path = /srv/samba/euroshare browsable = yes writable = yes guest ok = yes read only = no create mask = 0644 directory mask = 2777
Next, we’ll need to give the sambashare user access to the folder with:
sudo chown -R sambashare /srv/samba/euroshare
Restart Samba with:
sudo systemctl restart smb
Now, the sambashare user should have full access to the share.
And that’s how we do the Samba with RHEL-based Linux distribution. You can now dance it out, knowing you’ve made it possible for users on your network to access the files and folders within.
Subscribe to TechRepublic’s How To Make Tech Work on YouTube for all the latest tech advice for business pros from Jack Wallen.