728x90

sftp 로그를 남겨보자.

sftp 로그는 남지 않습니다. 그 방식이 inet 방식이 되었든 standalone가 되었든 안남습니다.
왜 남지 않을까요?
생각해보았지만, ftp로그에도 별도로 남지는 않더라구요.

ftp 로그는 저는 xferlog로 남기지만, 암튼 남지 않는건 확실합니다. 

 

 

vi /etc/ssh/sshd_config 
루트로 로그인 하여 다음의 설정 상황을 살펴봅시다.
119 # override default of no subsystems
120 Subsystem       sftp    /usr/libexec/openssh/sftp-server -f local2 -l INFO

편의상 set nu로 줄표시를 하였습니다. 

이것과 상관이 있지는 않습니다. 

일단 멘페이지에서 관련된 메뉴얼을 확인해보았습니다. 
번역을 할까 말까 했는데, 우리가 관심있게 봐야 할 것은 로그레벨 설정하는 것과 로그 패실리티 설정하는 것 두개만 존재한다고 보면
될것 같습니다. 


man sftp-server
SFTP-SERVER(8)            BSD System Manager’s Manual           SFTP-SERVER(8)

NAME
     sftp-server - SFTP server subsystem

SYNOPSIS
     sftp-server [-f log_facility] [-l log_level]

DESCRIPTION
     sftp-server is a program that speaks the server side of SFTP protocol to stdout and expects client requests from
     stdin.  sftp-server is not intended to be called directly, but from sshd(8) using the Subsystem option.

     Command-line flags to sftp-server should be specified in the Subsystem declaration.  See sshd_config(5) for more
     information.

     Valid options are:

     -f log_facility
             Specifies the facility code that is used when logging messages from sftp-server.  The possible values
             are: DAEMON, USER, AUTH, LOCAL0, LOCAL1, LOCAL2, LOCAL3, LOCAL4, LOCAL5, LOCAL6, LOCAL7.  The default is
             AUTH.

     -l log_level
             Specifies which messages will be logged by sftp-server.  The possible values are: QUIET, FATAL, ERROR,
             INFO, VERBOSE, DEBUG, DEBUG1, DEBUG2, and DEBUG3.  INFO and VERBOSE log transactions that sftp-server
             performs on behalf of the client.  DEBUG and DEBUG1 are equivalent.  DEBUG2 and DEBUG3 each specify
             higher levels of debugging output.  The default is ERROR.

     For logging to work, sftp-server must be able to access /dev/log.  Use of sftp-server in a chroot configuation
     therefore requires that syslogd(8) establish a logging socket inside the chroot directory.

SEE ALSO
     sftp(1), ssh(1), sshd_config(5), sshd(8)

     T. Ylonen and S. Lehtinen, SSH File Transfer Protocol, draft-ietf-secsh-filexfer-00.txt, January 2001, work in
     progress material.

AUTHORS
     Markus Friedl 〈markus@openbsd.org

HISTORY
     sftp-server first appeared in OpenBSD 2.8 .

BSD                             August 30, 2000                            BSD
(END) 

 

그 다음은 로그를 관리해야 할 부분을 세팅해야 합니다. 

 

 

vi /etc/syslog.conf 
35 local2.*                                        /var/log/sftp.log
가장 바닥에 셋팅하면 됩니다.

여기가 좀 중요한것 같은데,
syslog 재시작 해주고, sshd 재시작해주면 됩니다. 
순서가 중요하다고 이런 저런 사이트에서 보면 있네요.

 

되는지 안되는지 확인해보면 됩니다. 


tail -f /var/log/sftp.log 
Apr 16 17:59:02 www sftp-server[2985]: debug1: request 291: sent names count 1
Apr 16 17:59:02 www sftp-server[2985]: debug1: read eof
Apr 16 17:59:02 www sftp-server[2985]: session closed for local user 

 

되는 것을 확인합니다.


반응형

+ Recent posts