[파일] zzang911.net 의 proftpd 설정 -아랑

ServerName          “LINUX.ZZANG911.NET”

# ————————————————————-

# ServerType은 Server를 standalone mode 로 할건인지 inet mode로

# 할것인지를 결정하는 설정부분이다. standalone mode 로 할 경우는

# 아래의 MaxInstances 지시자의 주석을 해제한다. inet mode 로 할

# 경우 /etc/inetd.conf 중에서

# ftp   stream tcp  nowait root /usr/sbin/tcpd in.ftpd -l -a 를

# ftp stream tcp  nowait root /usr/sbin/tcpd in.ftpd 로 수정해

# 주고 inetd 데몬을 재실행 해준다.

# ————————————————————

ServerType          standalone

DefaultServer           on

AuthPAMAuthoritative           on

# —————————————————————

# Server Type 이 standalone 이면 이항목의 주석을 풀어 줘야 한다.

# inet mode 로 작동을 시킬시에는 ?etc/services 에서 port 를 지정

# 한다.

# ————————————————————–

Port                21

# root 계정의 접속허가 여부를 설정한다.

RootLogin           off

# Global section 은 proftpd 의 전체적인 설정을 모두 적용 시킨다.

<Global>

Umask               022

</Global>

# 회선의 bound width 를 특정 속도로 제한한다. 단위는 bbs

RateReadBPS         0

RateReadFreeBytes   0

RateReadHardBPS     on

# Dos 공격을 막기 위해 자식 Process 의 Maximun number 를

# 조정한다.

MaxInstances            10

# 접속 대기 시간 설정

TimeoutIdle             100

# Client가 접속인증을 허락 받기 전에 Server name를 display

# 하지 않는다.

DeferWelcome            on

DisplayLogin            /etc/welcome.msg

DisplayFirstChdir       .message

User                nobody

Group               nobody

# ls 명령어로 히든 파일을 보이게 할지를 결정한다.

#LsDefaultOptions “-a”

# Ratios on

# HostRatio foobar.net 100 10 5 100000

# 일반적으로 file 들을 overwrite 가능하게 한다.

<Directory /*>

  AllowOverwrite        on

</Directory>

# anonymous 전체 설정 부분

<Anonymous ~ftp>

  User              ftp

  Group             ftp

# anonymous 가 shell 권한을 얻는것을 방지한다.

  RequireValidShell             off

# Anonymous 접근을 할때 특정 password 를 지정할수 있다.

# 단 위이 user 지시자의 name 이 passwd file 에 등록이 되어져

# 있어야 한다. 이 지시자가 on 일 경우 이메일 주소로 login 을

# 할수가 없다.

#AnonRequirePassword        on

ShowSymlinks            off

  UserAlias         anonymous ftp

# Anonymous 최대 접근 가능수

  MaxClients            3

# 한 호스트에서 접속 가능한 수

  MaxClientsPerHost     1   “Sorry, one connection allow per one host”

# root 소유의 파일은 보이지 않는다.

  HideUser              alang

  HideGroup             alang

  DisplayLogin          /etc/welcome.msg

  DisplayFirstChdir     .message

# 특정 아이피에서만 접근 가능

<Limit LOGIN>

Order allow,deny

Allow from 211.47.67.

Allow from 211.47.64.

Deny from all

</Limit>

  # anonymous 로 접근하는 사용자들의 읽기와 쓰기 권한을 막아 버린다.

  <Limit WRITE>

    DenyAll

  </Limit>

  <Limit READ>

    DenyALL

   </Limit>

  # anonymous 계정으로 접근할수 있는 디렉토리별로의 허가권 설정..

  # 일단은 모든 디렉토리에 쓰기 권한은 주지 않는설정이다.

<Directory *>

    <Limit WRITE>

    DenyAll

    </Limit>

</Directory>

# incoming 디렉토리에 읽기권한을 주기않고..upload 권한만 부여.

<Directory incoming>

    <Limit READ>

    DenyAll

    </Limit>

    <Limit STOR MKD>

    AllowAll

    </Limit>

</Directory>

# upload 디렉토리에 read , upload 권한 모두 허가.

  <Directory upload>

     <Limit READ>

       AllowALL

     </Limit>

     <Limit STOR MKD>

       AllowALL

     </Limit>

   </Directory>

   <Directory pub>

     <Limit READ>

       AllowALL

     </Limit>

     <Limit STOR MKD>

       DenyALL

     </Limit>

   </Directory>

# 사용자가 접그나기를 원하지 않는 private directory

   <Directory Alangbackup>

        <Limit READ WRITE DIRS>

            DenyAll

        </Limit>

    </Directory>

</Anonymous>

—————————————————————

proftp 관련 명령어…

1. ftpcount

ftp 를 사용중인 사용자 수를 알수 있다.

[root@zzang911 /root]# ftpcount

Master proftpd process 8672:

   –  –      1 user

2. ftpwho

ftp 사용자가 누구인지 알수 있다.

[root@zzang911 /root]# ftpwho

Master proftpd process 8672:

8728 0m36s  proftpd: alang – zzang911.net: IDLE

   –  –      1 user

3. ftpshut

ftp 데몬을 shutdown 시키는 명령이다. 사용 방식은 아래와 같다.

ftpshut -l [min] -d [min] [time] [message]

-l : shutdown 전 접속하는 사용자를 거부하는 시간을 정하는 옵션이다.

-d : shutdown 전 이미 접속되어져 있는 사용자를 종료시키는 시간을 나타낸다.

time : 접속종료 시간으로 HHMM 표기로 나타낸다.

message : 접속거부나 현재 연결된 session 을 종료 시킬때

부가적으로 메세지를 display 할수 있다.

메세지는 아래 변수를 사용하여 작성할수가 있다.

%s : proftpd 가 종료되는 시간

%r : 새로운 접속이 거부되기 시작하는 시간

%d : 현재 접속이 종료되는 시간

%C : 현재 작업중인 디렉토리

%L : local host name

%R : remote host name

%T : local time

%U : login time 시 주어진 username

하나의 예로..

ftpshut -l 5 -d 3 1500 명령을 내리면 …

오후 3시에 ftp 종료하는데 3시 5분전 부터 새로운 접속자는 접속 거부 되고

3분 전에는 접속중인 사용자들도 강제 종료된다.

ftpshut now

즉시 종료된다.

이런식으로 사용한다.

서진우

슈퍼컴퓨팅 전문 기업 클루닉스/ 상무(기술이사)/ 정보시스템감리사/ 시스존 블로그 운영자

You may also like...

페이스북/트위트/구글 계정으로 댓글 가능합니다.