2022-06-25 11:37:54 +02:00
|
|
|
|
---
|
|
|
|
|
title: Samba
|
2022-11-19 15:25:20 +01:00
|
|
|
|
visible: true
|
2022-06-25 11:37:54 +02:00
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
[toc]
|
|
|
|
|
## Linux Server
|
|
|
|
|
`sudo apt install samba smbclient`
|
|
|
|
|
|
|
|
|
|
samba conf backup
|
|
|
|
|
`sudo cp /etc/samba/smb.conf /etc/samba/smb.conf_backup`
|
|
|
|
|
|
|
|
|
|
*Samba users have to exist on the system as well before they are added to samba's user management system.*
|
|
|
|
|
Add user to samba and create a password for it
|
|
|
|
|
`sudo smbpasswd -a (user)`
|
|
|
|
|
|
|
|
|
|
Directories can be shared with groups or users.
|
|
|
|
|
Make sure to [set the owner and group](/content/linux-other/files.html) for the directories you want to share.
|
|
|
|
|
|
|
|
|
|
### Sharing with users
|
|
|
|
|
```
|
|
|
|
|
[sharename]
|
|
|
|
|
path = (absolute path)
|
|
|
|
|
read only = no
|
|
|
|
|
writeable = yes
|
|
|
|
|
browseable = yes
|
|
|
|
|
valid users = (user), (user 2), (user 3)
|
|
|
|
|
create mask = 0660
|
|
|
|
|
directory mask = 0770
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Sharing with groups
|
|
|
|
|
Make sure to add all users to the group
|
|
|
|
|
The "@" signals samba that this is a group
|
|
|
|
|
```
|
|
|
|
|
[sharename]
|
|
|
|
|
path = (absolute path)
|
|
|
|
|
read only = no
|
|
|
|
|
writeable = yes
|
|
|
|
|
browseable = yes
|
|
|
|
|
valid users = @(group)
|
|
|
|
|
create mask = 0660
|
|
|
|
|
directory mask = 0770
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Finally, restart the samba service.
|
2022-11-19 15:25:20 +01:00
|
|
|
|
`sudo systemctl restart smbd`
|