============================================================================================= freebsd samba ============================================================================================= by o1 FreeBSD condo 13.1-RELEASE-p7 FreeBSD 13.1-RELEASE-p7 GENERIC amd64 ============================================================================================= install samba --------------------------------------------------------------------------------------------- pkg search samba pkg install samba413 ============================================================================================= create zfs --------------------------------------------------------------------------------------------- # create zpool zpool create -f -m /export -o autoexpand=off -O compression=lz4 tank ada1 # create zfs zfs create tank/samba zfs create tank/samba/public zfs create tank/samba/production zfs create tank/samba/accounting chmod -R 2777 /export/samba/* ============================================================================================= /etc/rc.conf --------------------------------------------------------------------------------------------- # samba413 samba_server_enable="YES" ============================================================================================= /usr/local/bin/smb4.conf --------------------------------------------------------------------------------------------- https://www.samba.org/samba/docs/current/man-html/smb.conf.5.html [global] netbios name = Acme server string = Acme domain master = yes preferred master = yes hosts allow = 192.168.2. 10.10.10. security = user map to guest = bad user create mask = 0777 force create mode = 0777 directory mask = 2777 force directory mode = 2777 read only = no log level = 3 acl allow execute always = yes client min protocol = NT1 server min protocol = NT1 hide files = /$RECYCLE.BIN/System Volume Information/desktop.ini/Thumbs.db/ veto files = /.AppleDouble/.bin/.AppleDesktop/Network Trash Folder/ [public] path = /export/samba/public comment = public guest ok = yes [production] path = /export/samba/production comment = production valid users = bob, john, lucy, mike [accounting] path = /export/samba/accounting comment = accounting valid users = bob, john, steve, george, sarah --------------------------------------------------------------------------------------------- testparm -vd service samba_server start ============================================================================================= manage users --------------------------------------------------------------------------------------------- # check config changes testparm # create user pdbedit -a -u bob # change password (no mistake, it is the same as above) pdbedit -a -u bob # remove user pdbedit -x -u bob # list user pdbedit -L -u bob # list all users pdbedit -L ============================================================================================= install clamav --------------------------------------------------------------------------------------------- pkg install clamav unrar ============================================================================================= /etc/rc.conf --------------------------------------------------------------------------------------------- # clamav clamav_clamd_enable="YES" clamav_freshclam_enable="YES" --------------------------------------------------------------------------------------------- freshclam ============================================================================================= create zfs --------------------------------------------------------------------------------------------- zfs create tank/quarantine ============================================================================================= virus scanning --------------------------------------------------------------------------------------------- clamscan -i -r --move=/export/quarantine /export/samba ============================================================================================= mount by hand --------------------------------------------------------------------------------------------- mount_smbfs -I //@samba_server/share_name /mount/point ============================================================================================= mount on boot /etc/fstab --------------------------------------------------------------------------------------------- //user@samba_server/share_name /mount/point smbfs rw,-N,-I,-u,-g,-f,-d 0 0 ============================================================================================= mount on boot ~/nsmbrc --------------------------------------------------------------------------------------------- smbutil crypt user <----- generate password for user ($$123456789101) [SAMBA_SERVER:USER] password=$$123456789101 =============================================================================================