How to create a passwordless guest share in Samba

0
32


Samba is a great tool for sharing data on your LAN and Jack Wallen shows you how to use it to share a guest folder that doesn’t require a user account on your system.

Image: iStockphoto/Artur

If you have multiple users on your LAN, chances are pretty good those users need easy access to file shares. Those shares are probably password protected (as they should be) to prevent unwanted people from gaining access to the data within. But what if you sometimes have guests that pop up on your LAN (say, customers, clients, or temp employees)? Should that be the case, you might need to make a password-less share or two accessible to those guests or temps.

How do you do that?

Samba, that’s how.

Let me show you.

SEE: Hiring Kit: Network Engineer (TechRepublic Premium)

What you’ll need

To make this work, you’ll need a Linux server and a user with sudo privileges. I’ll be demonstrating on Ubuntu Server 20.04. If you’re using a different distribution, you’ll need to alter the installation command accordingly.

How to install Samba

The first thing we’ll do is install Samba. Log into your Linux server and issue the command:

sudo apt-get install samba -y

Start and enable the Samba service with:

sudo systemctl enable --now smbd

How to configure Samba
Before we configure Samba, let’s find out what our LAN network interface is with the command:

ip a

Locate the NIC associated with your LAN address, which will be something like ens5. Open the Samba configuration file with:

sudo nano /etc/samba/smb.conf

Locate the line:

; interfaces = 127.0.0.0/8 eth0

Change that to:

interfaces = 127.0.0.0/8 IFACE

Where IFACE is the interface name.

To make sure Samba is only listening to that interface locate the below line:

; bind interfaces only = yes

Change that line to:

bind interfaces only = yes

Next, at the bottom of this file, we’re going to create the new public share with the following:

[public]
path = /home/share
public = yes
guest only = yes
writable = yes
force create mode = 0666
force directory mode = 0777
browseable = yes

Save and close the file.

How to create the shared directory

Next, we’re must create a directory to house the shares. Back at the terminal, create the directory with:

sudo mkdir /home/share

Now, we’ll give it the necessary permissions with:

sudo chmod -R ugo+w /home/share

Restart Samba with:

sudo systemctl restart smbd

At this point, the newly-created share should be accessible via anonymous access.

A couple of warnings

The first warning is that this is not the most secure route to take with sharing data. But there are instances where you simply don’t have another way of sharing data to guests who do not (and should not) have accounts on your network. Because of this, you should consider creating these shares on a system that is connected to a guest network (without access to your regular LAN). At least that way, if someone were to attempt to leverage that guest access for malicious intent, they won’t be able to get far.

Another word of warning is this—because these shares are guest accessible, do not add data into that /home/share directory that is sensitive or private. Use these guest shares wisely and they’ll serve you well. Use them poorly and they could cause trouble.

Subscribe to TechRepublic’s How To Make Tech Work on YouTube  for all the latest tech advice for business pros from Jack Wallen.



Source link

Leave a reply

Please enter your comment!
Please enter your name here