samba – how to install and administrate a samba server

Reading Time: 2 minutes

Last Edited: 8/29/2022

This is going short introduction on how to deploy “samba” on Linux. The goal of this is to use a Linux deployment in order to share out data in a fashion that a “Microsoft” client will accept.

How to Install:

The way to install samba is very simple and has remain unchanged for a period of time.

sudo apt update
sudo apt install samba

Administrate Samba:

In the next bit we are going to talk about how to create users for use in Samba, and how that administratively maps back to our Linux users and groups. Administrating a samba server can be done with a few simple commands.

How to add a user to Samba

sudo smbpasswd -a ubuntu

Note: The username “user” not accepted. The username “ubuntu” is accepted.

Note: Enable the user

sudo smbpasswd -e ubuntu

Now we are going to review one of the one important tasks of samba administration. We are going to learn how to edit the /etc/samba/smb.conf file. This file is used to declare which portions are made available through smb/cif.

A simple example is below which maps the linux space /mnt/lvnfs to a “share” named “DATA” (shared as stated caps and all).

[DATA]
path = /mnt/lvnfs
valid users = @editors
browsable = yes
writable = yes
read only = no

Restart Samba with the command:

sudo systemctl restart smbd

Create a new security group:

sudo newgrp editors

Add yourself to the group:

sudo usermod -aG editors $USER

Change the group of the directory in question to that of the security group we are going to use.

sudo chgrp -R editors: /mnt/lvnfs

Adjust the “read; write” permissions for what is effectively the data store.

sudo chmod -R g+rw /mnt/lvnfs

Note: For web based administration you could consider using “webmin”.

references:

  • https://www.techrepublic.com/article/how-to-create-a-samba-share-on-ubuntu-server-20-04
  • https://en.wikipedia.org/wiki/Samba
  • https://en.wikipedia.org/wiki/Server_Message_Block
  • https://www.webmin.com/
This entry was posted in Linux, Networking, samba. Bookmark the permalink.