Nachádzate sa tu

Samba and printer setup

/etc/samba/smb.conf

[global]
server role = standalone server
hosts allow = 192.168.0.0/24
hosts deny = 0.0.0.0/0
server string = Share
workgroup = WORKGROUP
name resolve order = bcast host

[Kultura]
#defaults
browsable = yes
read only = no
public = yes
#end of defaults
comment = share1
path = /mnt/Data/Kultura
valid users = kultura infocentrum
writable = yes
force user = kultura
force group = smbgroup
create mask = 0664
force create mode = 0664
directory mask = 0775
force directory mode = 0775

[Infocentrum]
#defaults
browsable = yes
read only = no
public = yes
#end of defaults
comment = Infocentrum share
path = /mnt/Data/Infocentrum
valid users = infocentrum kultura
writable = yes
force user = infocentrum
force group = smbgroup
create mask = 0664
force create mode = 0664
directory mask = 0775
force directory mode = 0775

[HPLaserJetP1102]
printable = yes
available = yes
printer name = HP-LaserJet-Professional-P1102
# listed by lpstat -p -d
path = /var/tmp/
valid users = printeruser

Share on /mnt/Data

sudo groupadd --system smbgroup

Create user: adri
sudo useradd --system --no-create-home --group smbgroup -s /bin/false adri

Create samba password for user: adri
sudo smbpasswd -a adri

sudo mkdir /mnt/Data/Adri
sudo chown -R adri:smbgroup /mnt/Data/Adri

Add write access for group: smbgroup
sudo chmod -R g+w /mnt/Data

sudo chmod 0770 /mnt/Data

Add user: user to smbgroup
sudo usermod --append --groups smbgroup user

Change a User’s Primary Group
sudo usermod --gid smbgroup user

Remove a User from a Group
gpasswd --delete Adri smbgroup

Restart samba service
sudo service smbd restart
/etc/init.d/samba restart
systemctl restart samba

testparm

watch smbstatus -v

List server shares:
smbclient -L 192.168.0.0

List samba users:
sudo pdbedit -L -v

List printer names:
lpstat -p -d