181 lines
4.2 KiB
Markdown
181 lines
4.2 KiB
Markdown
##Install Samba server
|
|
|
|
1. Install Samba
|
|
```bash
|
|
sudo apt install samba smbclient cifs-utils samba-vfs-modules -y
|
|
```
|
|
2. Create public share folder and shared file inside
|
|
```bash
|
|
mkdir public
|
|
|
|
touch /home/canary/public/finance.xlsx
|
|
|
|
sudo chown $USER:$USER public
|
|
sudo chmod 755 -R public
|
|
```
|
|
3. Edit Samba config file
|
|
```bash
|
|
#Backup original file
|
|
sudo mv /etc/samba/smb.conf /etc/samba/smb.conf.backup
|
|
|
|
#Create new file
|
|
sudo nano /etc/samba/smb.conf
|
|
|
|
#Put following congiuration
|
|
[global]
|
|
interfaces = xxx.xxx.xxx.xxx/xx eth0
|
|
workgroup = csec.local
|
|
server string = FileServer
|
|
netbios name = FILESRV01
|
|
dns proxy = no
|
|
log file = /var/log/samba/log.all
|
|
log level = 0
|
|
max log size = 100
|
|
panic action = /usr/share/samba/panic-action %d
|
|
#samba 4
|
|
server role = standalone server
|
|
#samba 3
|
|
#security = user
|
|
passdb backend = tdbsam
|
|
obey pam restrictions = yes
|
|
unix password sync = no
|
|
map to guest = bad user
|
|
usershare allow guests = yes
|
|
load printers = no
|
|
vfs object = full_audit
|
|
full_audit:prefix = %U|%I|%i|%m|%S|%L|%R|%a|%T|%D
|
|
full_audit:success = connectpath
|
|
#full_audit:success = connect connectpath open
|
|
#full_audit:success = fstat
|
|
#full_audit:success = pread_recv pread_send
|
|
full_audit:failure = none
|
|
full_audit:facility = local7
|
|
full_audit:priority = notice
|
|
[public]
|
|
comment = All the stuff!
|
|
path = /home/canary/public
|
|
guest ok = yes
|
|
read only = yes
|
|
browseable = yes
|
|
force user = canary
|
|
```
|
|
4. Set rights (follow instructions)
|
|
```bash
|
|
sudo smbpasswd -a canary
|
|
```
|
|
5. Edit Rsyslog
|
|
```bash
|
|
#Backup original file
|
|
sudo mv /etc/rsyslog.conf /etc/rsyslog.conf.backup
|
|
|
|
#Create new file
|
|
sudo nano /etc/rsyslog.conf
|
|
|
|
#Put following configuration
|
|
|
|
# /etc/rsyslog.conf configuration file for rsyslog
|
|
#
|
|
# For more information install rsyslog-doc and see
|
|
# /usr/share/doc/rsyslog-doc/html/configuration/index.html
|
|
|
|
|
|
#################
|
|
#### MODULES ####
|
|
#################
|
|
|
|
module(load="imuxsock") # provides support for local system logging
|
|
module(load="imklog") # provides kernel logging support
|
|
#module(load="immark") # provides --MARK-- message capability
|
|
|
|
# provides UDP syslog reception
|
|
#module(load="imudp")
|
|
#input(type="imudp" port="514")
|
|
|
|
# provides TCP syslog reception
|
|
#module(load="imtcp")
|
|
#input(type="imtcp" port="514")
|
|
|
|
|
|
###########################
|
|
#### GLOBAL DIRECTIVES ####
|
|
###########################
|
|
|
|
#
|
|
# Use traditional timestamp format.
|
|
# To enable high precision timestamps, comment out the following line.
|
|
#
|
|
$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat
|
|
|
|
#
|
|
# Set the default permissions for all log files.
|
|
#
|
|
$FileOwner syslog
|
|
$FileGroup adm
|
|
$FileCreateMode 0640
|
|
$DirCreateMode 0755
|
|
$Umask 0022
|
|
|
|
#
|
|
# Where to place spool and state files
|
|
#
|
|
$WorkDirectory /var/spool/rsyslog
|
|
|
|
#
|
|
# Include all config files in /etc/rsyslog.d/
|
|
#
|
|
$IncludeConfig /etc/rsyslog.d/*.conf
|
|
|
|
###############
|
|
#### RULES ####
|
|
###############
|
|
|
|
#
|
|
# First some standard log files. Log by facility.
|
|
#
|
|
auth,authpriv.* /var/log/auth.log
|
|
*.*;auth,authpriv.none -/var/log/syslog
|
|
#cron.* /var/log/cron.log
|
|
daemon.* -/var/log/daemon.log
|
|
kern.* -/var/log/kern.log
|
|
lpr.* -/var/log/lpr.log
|
|
mail.* -/var/log/mail.log
|
|
user.* -/var/log/user.log
|
|
local7.* /var/log/samba-audit.log
|
|
|
|
#
|
|
# Logging for the mail system. Split it up so that
|
|
# it is easy to write scripts to parse these files.
|
|
#
|
|
mail.info -/var/log/mail.info
|
|
mail.warn -/var/log/mail.warn
|
|
mail.err /var/log/mail.err
|
|
|
|
#
|
|
# Some "catch-all" log files.
|
|
#
|
|
*.=debug;\
|
|
auth,authpriv.none;\
|
|
mail.none -/var/log/debug
|
|
*.=info;*.=notice;*.=warn;\
|
|
auth,authpriv.none;\
|
|
cron,daemon.none;\
|
|
mail.none -/var/log/messages
|
|
|
|
#
|
|
# Emergencies are sent to everybody logged in.
|
|
#
|
|
*.emerg :omusrmsg:*
|
|
```
|
|
6. Create Samba audit log file and change owner
|
|
```bash
|
|
sudo touch /var/log/samba-audit.log
|
|
|
|
sudo chown syslog:adm /var/log/samba-audit.log
|
|
```
|
|
|
|
7. Reboot device to apply all changes
|
|
```bash
|
|
sudo reboot now
|
|
```
|
|
|
|
[Back to home](./README.md) |