Samba Cheatsheet
User Management
List Users
sudo pdbedit --list --verbose
... or for more detailed information
sudo pdbedit --list --verbose | less
Add Users
This is the "samba way" to add SAMBA users (and definitely the way to use if you are using SAMBA for active directory).
samba-tool user create myUserName
However, I have been using the following in the past to create linux users don't have a home directory and can't login with SSH, which works with how I set up SAMBA for file sharing.
sudo useradd \
--no-create-home \
--shell /usr/sbin/nologin \
steve
You should see the user like so in the /etc/passwd
file:
richard:x:1029:1029::/home/richard:/usr/sbin/nologin
Set User Password
Then set a password for the user for the first time:
sudo smbpasswd -a $USERNAME
pnbedit
smbpasswd
Samba Service
Restart Samba Service
sudo service smbd start
Configuration
Add Another Share
Add a section like below to the /etc/samba/smb.conf
file. Obviously tweak the values as necessary.
[MyShare]
comment = Read only share except for authorized users
path = /mydata/mystuff/
public = no
guest ok = no
read only = yes
create mask = 0644
directory mask = 0755
force group = mygroup
write list = myname, @mygroup
References
- samba.org - pdbedit
- Ubuntu forums - Samba force create/directory mode/mask not replicating in file system
Last updated: 5th August 2020
First published: 24th June 2019
First published: 24th June 2019