-
Notifications
You must be signed in to change notification settings - Fork 0
samba
sudo apt-get install samba-common samba tdb-tools
-> /etc/samba/smb.conf
# #################################
# Shares <my-network>
# #################################
[share]
path = /home/admin/share/
comment = Some share folder (no password needed)
public = yes
guest ok = yes
# Not forcing a user was causing problems for my as guest
force user = admin
writeable = yes
browsable = yes
printable = no
[data]
path = /mnt/data-disk-mount-path/
comment = Data hard drive
valid users = admin
force user = admin
writeable = yes
browsable = yes
printable = no
# This share grants user `vids` read access while `admin` still has read/write access
[hdd2]
path = /mnt/vids/
comment = Videos etc.
valid users = vids admin
force user = admin
read only = yes
write list admin
browsable = yes
printable = no
Thes if the config is valid with testparm
.
Socket starts demon on first connection; Service: on boot
Replace smbd.socket
by smbd.service
depending on what is used:
# Enable needed services (to be autostarted @reboot)
systemctl enable nmbd.service smbd.socket
# Start needed services (to be autostarted @reboot)
systemctl start nmbd.service smbd.socket
# Restart nmbd.service and smbd.socket to apply changes of `smb.conf`
systemctl restart nmbd.service smbd.socket
# Get status if everything works fine
systemctl status nmbd.service smbd.socket
This user must exist as a UNIX user (-> sudo adduser --no-create-home --disabled-password --disabled-login <uname>
(Without these options to prevent login via other channels (i.e. ssh, ...) you might introduce security risks) + set password with: passwd <pw>
).
Samba has its own user database for access control (use this also to set a new password for an exiting user):
sudo smbpasswd -a <new_samba_user>
List samba users:
sudo pdbedit -L -v
You will then be prompted to enter and confirm a password
smbclient -L <share-domain> -U <usr-name>
-
guest ok = yes
==public = yes
-
printable
: For printer sharing (otherwise =no
) -
Veto files: Prevent creation of certain files on the shares (in this example MacOS auto-generated files)
- The share definitions can locally overwrite these settings
veto files = /.DS_Store/._*/ delete veto files = yes
sudo smbstatus
Install gvfs-smb
or gvfs-bin
Valid path for terminal (after mount) of a network share via gvfs
(i.e. in a terminal session or in Thunar): /run/user/1000/gvfs/
(1000
can differ)
-
Unable to open new log file /usr/local/samba/var/log.ronda: No such file or directory
- Execution of
smbcontrol
orsmbd
command when smbd runs as user uid (not root uid); When smbd runs as user uid, the log file cannot be opened again because there are no right to write to the directory. - Put this under the [global] section:
logfile = /var/log/samba/log.%m
- and make sure that /var/log/samba exists.
- Execution of
- Invoking
smbclient
returns/etc/samba/smb.conf
not found. Just create an empty file. Works for most cases.
- https://wiki.ubuntuusers.de/Samba_Server/ (I would consider it as the main guide)
- https://git.samba.org/samba.git/?p=samba.git;a=blob_plain;f=examples/smb.conf.default;hb=HEAD (Contains the most valuable information about configuring network shares)
- https://wiki.archlinux.org/index.php/samba#Server_configuration (Complementary information)
- https://www.samba.org/samba/docs/man/manpages-3/smb.conf.5.html (Detailed information about smb.conf)
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License *.
Code (snippets) are licensed under a MIT License *.
* Unless stated otherwise