Linux

samba log 설정

Naan 2014. 2. 20. 18:17
반응형

samba log 세부 설정하는 방법이다.


smb.conf 파일을 수정한다.

공유하고 있는 폴더가 test 라 가정하고


# vi /etc/samba/smb.conf


[test]

writeable = yes

valid users = test

path = /data/test

vfs objects = full_audit

full_audit:prefix = %u|%I|%m|%S

full_audit:success = read pread write pwrite

full_audit:failure = none

full_audit:facility = LOCAL7

full_audit:priority = ALERT


syslog.conf 파일도 수정

# vi /etc/rsyslog.conf
# samba log
local7.*                        /var/log/samba/log.audit

라고 설정을 하고 samba를 재시작

# service smb restart 
# service rsyslog restart 

# vi /var/log/samba/log.audit 열어보면

Feb 19 14:38:21 test smbd_audit: test|192.168.113.5|pread|ok|test.txt

Feb 19 14:38:24 test smbd_audit: test|192.168.113.5|pread|ok|test2.txt

Feb 19 14:38:26 test smbd_audit: test|192.168.113.5|pread|ok|test3.txt

Feb 19 14:38:37 test smbd_audit: test|192.168.113.5|pread|ok|test.txt

Feb 19 14:38:39 test smbd_audit: test|192.168.113.5|pread|ok|test2.txt

Feb 19 14:38:41 test smbd_audit: test|192.168.113.5|pread|ok|test3.txt


로그가 쌓인것을 확인 할수 있다.


http://www.samba.org/samba/docs/man/manpages-3/vfs_full_audit.8.html

위 사이트를 참고해서 더 디테일하게 설정을 남길수 있다 


경로 지정안한다면 아래와 같이

#log

vfs objects = full_audit

full_audit:prefix = %u|%m

full_audit:success = read pread write pwrite chmod rmdir unlink mkdir rename

full_audit:failure = none

full_audit:facility = local7

full_audit:priority = ALERT




추가

----------------------------------------------------------------------------------

centos7 에서는 위와 같이 하면 이상하게 안된다...

samba 버전차이인것 같기도 하고... 알아보기 귀찮아서.. 대충


smb.conf 

는 아래와 같이 하고.

[global]

workgroup = MYGROUP

log file = /var/log/samba/log.%m

log level = 3

idmap config * : backend = tdb


vfs objects = full_audit


# Audit settings

full_audit: prefix = %u|%I|%m|%S

full_audit:failure = connect

full_audit:success = connect mkdir rmdir open read pread write pwrite rename unlink

full_audit:facility = local5

full_audit: priority = notice




[data]

path = /data/

vfs object = full_audit

valid users = user




# vi /etc/rsyslog.conf
local5.*                        /var/log/samba/log.audit
로 바꾸니깐 된다...

뭐가 문제인지...


반응형