A little knowledge for configuring Samba-shares by hand

Installation

On Ubuntu 20:

# apt-get install samba

Settings

/etc/samba/smb.conf

Good information: http://linux-training.be/networking/ch21.html

General settings

Let more or less as it is for a simple file sharing.

Sahres

Management of users and groups

General

Samba needs “own” users

But the user must exist in linux before creating the corresponding samba-user.

By removing is the same way but in the other direction: first remove the samba-user and then the unix-user

The passwords for unix and samba can be different but setting the same make the life easier (!)

Even if setting into etc/samba/smb.conf, the sync of the users between unix and samba seems not to work => disable the sync into /etc/samba/smb.conf and sync by hand with the CLI

Some important commands

Small tricks https://wiki.guedel.eu/doku.php?id=welcome:linux_usually:small_tricks#users_and_groups

restart samba server

# systemctl restart smbd

test config of /etc/samba/smb.conf

# testparm

list the unix groups

# cat /etc/groups

remove a user from a group

# gpasswd -d username groupname

add a user into a group

# usermod -a -G groupname username

list groups from a user

# groups username

list users

# cat /etc/passwd

remove the unix-user

# deluser username

remove the samba-user

# smbpasswd -x username

create or change password of a samba-user

# smbpasswd -a username

create a unix-user

# adduser username

list the samba-users

# pdbedit -L -v

list UID and GUI of a user

id username

add a group a set its gid

# addgroup group_name --gid the_gid

add an user a set its uid

# adduser user_name --uid the_uid

check if samba runs

# systemctl status smbd nmbd

get information about samab running

# smbstatus

Shared folders

Permissions: