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 

 

되는 것을 확인합니다.


반응형
728x90

1. 먼저 /etc/inetd.conf 파일에서 FTP부분을 수정한다.

마지막 부분에 -l 옵션을 추가한다.


ftp stream tcp6 nowait /usr/sbin/ftpd ftpd -l


2. 그 다음에 /etc/syslog.conf 파일에 다음 1라인을 추가한다.


daemon.info /var/adm/ras/ftp.log


--> 당연히 /var/adm/ras/ftp.log파일은 미리 touch로 만들어놓아야겠죠....


3. 마지막으로 inetd와 syslogd 데몬을 refresh한다.


# touch /var/adm/ras/ftp.log


# refresh -s inetd


# refresh -s syslogd


출처: http://egloos.zum.com/donquite/v/8860506

반응형

'UNIX & LINUX > AIX' 카테고리의 다른 글

IBM JVM 튜닝  (0) 2015.10.27
AIX wget 설치  (0) 2015.10.20
728x90

Linux 에서 Tomcat과 nginx를 연동해 사용하려고 할 때 설정.

Tomcat

초기 설정대로 8080 포트로 실행한다.

nginx

  • /etc/nginx/conf.d/default.conf 수정 : location 정보를 추가해 80포트로 들어오는 요청을 8080 포트로 pass한다.
location = /50x.html {
        root   /usr/share/nginx/html;
    }
    location ~ \.do$ {
      proxy_pass              http://localhost:8080;
      proxy_set_header        X-Real-IP $remote_addr;
      proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header        Host $http_host;
    }
    location ~ \.jsp$ {
      proxy_pass              http://localhost:8080;
      proxy_set_header        X-Real-IP $remote_addr;
      proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header        Host $http_host;
    }
    location ^~/servlets/* {
      proxy_pass              http://localhost:8080;
      proxy_set_header        X-Real-IP $remote_addr;
      proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header        Host $http_host;
    }
    location ^~/* {
      proxy_pass              http://localhost:8080;
      proxy_set_header        X-Real-IP $remote_addr;
      proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header        Host $http_host;
    }

nginx Load Balancer

  • 만약 여러대의 서버로 구성된 애플리케이션 서버들이 있고 그 앞에 LB용(세션 정보 공유) 서버가 있다면 아래와 같이 upstream 정보로 서버 ip를 나열하고 proxy_pass로 upstream 정보를 입력한다.
upstream backend {
    ip_hash;
    server 210.122.7.224:80;
}

server {
    listen       80;
    location /resources/ {
        alias   /home/townus/resources/;
        autoindex off;
        access_log off;
        expires max;
    }
    location / {
        #root   /usr/share/nginx/html;
        #index  index.html index.htm;
        proxy_set_header Host $http_host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass  http://backend;
    }
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }


반응형

+ Recent posts