- /etc/ftpusers : ftp에 접속 불허할 계정 리스트
- /etc/pam.d/ftp : ftp 보안 관련 설정 파일
- /etc/proftpd.conf or /etc/proftpd/proftpd.conf : proftpd 기본 설정 파일
- /etc/rc.d/init.d/proftpd : proftpd standalone 데몬
- /var/ftp/incoming : anonymous ftp 파일 업로드 디렉토리
- /var/ftp/pub : anonymous ftp 파일 다운로드 디렉토리
- /usr/bin/ftpcount : 각 proftpd server 설정에 접속되어 있는 user의 숫자 출력
- /usr/bin/ftpwho : 각 ftp user들의 현재 process 정보 출력
- /usr/bin/ftpls : ftp 디렉토리 목록 출력
- /usr/bin/ftpcopy : 목적지 ftp에서 파일 다운로드
- /var/log/xferlog : ftp 로그 파일
1) /etc/ftpusers
ftpusers파일에 추가된 user들은 ftp접속을 하지 못합니다. 기본적으로 시스템 user들은 포함되어 있습니다.
[주의] 한컴리눅스 OS 3.0 버전의 설정파일 위치는 /etc/proftpd/ftpuser 입니다.
[root@ns root]# cat /etc/ftpusers root
bin
daemon
adm
lp
sync
shutdown
halt
mail
news
uucp
operator
games
gopher
nobody
mailnull
rpm
xfs
wnn
ntp
rpc
gdm
rpcuser
nscd
ident
radvd
mysql
apache
squid
named
pcap
amanda
junkbust
mailman
ldap
pvm anonymous
[root@ns root]#
위에 ftpusers에 anonymous계정이 추가되어 있어, 이 ftp서버에서는 익명 사용자의 접근을 허용하고 있지 않습니다. 만일 이를 허용하려면 파일에서 anonymous를 삭제하면 됩니다.
2) /etc/pam.d/ftp
PAM(Pluggable Authentication Modules)은 시스템 관리자가 응용프로그램들이 사용자를 인증하는 방법을 선택할 수 있는 공유 라이브러리 묶음입니다. 이 파일은 PAM관련 중 ftp에 대한 설정을 한 파일입니다. 자세한 PAM관련 문서는 #>man pam 명령으로 맨 페이지를 참조해 보시기 바랍니다.
[root@ns root]# cat /etc/pam.d/ftp
#%PAM-1.0 auth required /lib/security/pam_listfile.so item=user sense=deny file=/etc/ftpusers onerr=succeed
auth required /lib/security/pam_pwdb.so shadow nullok
# This is disabled because anonymous logins will fail otherwise,
# unless you give the 'ftp' user a valid shell, or /bin/false and add
# /bin/false to /etc/shells.
#auth required /lib/security/pam_shells.so
account required /lib/security/pam_pwdb.so
session required /lib/security/pam_pwdb.so
[root@ns root]#
위에서 살펴보듯이 file=/etc/proftpd/conf/ftpusers라고 설정되어 있기 때문에 ftpusers 파일에 있는 사용자들은 sense=deny에 의해 거부되게 됩니다.
3) /etc/proftpd.conf
[root@ns root]# cat /etc/proftpd.conf
ServerName "Proftpd FTP Server"
ServerType standalone
DefaultServer on
Port 21
Umask 022
MaxInstances 30
User nobody
Group nobody
UseReverseDNS off
IdentLookups off
AuthPAMAuthoritative on
RootLogin off
DenyFilter \*.*/
DeferWelcome on
TimesGMT off
#RateReadBPS 256
#RateReadFreeBytes 5120
#RateReadHardBPS on
# <Anonymous ~ftp>
# User ftp
# Group ftp
# UserAlias anonymous ftp
# MaxClients 10 "Sorry, maxium users %m -- try again later"
# MaxClientsPerHost 2 "Sorry, Over 2 connection not allow"
# DisplayLogin welcome.msg
# DisplayFirstChdir .message
# RequireValidShell off
# HideUser root
# HideGroup root
# Anonymous's Uploads Directory
# <Directory incoming/*>
# AllowOverwrite on
# AllowRetrieveRestart on
# AllowStoreRestart on
# <Limit DELE RMD>
# DenyAll
# </Limit>
# <Limit READ STOR MDK>
# AllowAll
# </Limit>
# </Directory>
# Anonymous's Public Directory
# <Directory pub/*>
# <Limit READ>
# AllowAll
# </Limit>
# <Limit STOR DELE RMD MKD>
# DenyAll
# </Limit>
# </Directory>
#</Anonymous>
[root@ns root]#
자세한 설명은 /usr/share/doc/proftpd-버전/Configuration.html 파일에 나와 있습니다. html 형식이므로 손쉽게 살펴볼 수 있습니다.
>> 위의 설정에서 anonymous 관련은 모두 주석(#)처리 되어 있습니다. 만일 익명 사용자를 허용하려면, /etc/ftpusers 파일에 anonymous 계정을 삭제하고, 위의 굵은 글자로 쓰여진 anonymous 관련 주석을 모두 삭제한 다음, proftpd 데몬을 재 실행하면 됩니다.
여기에서는 중요한 몇가지만 살펴보겠습니다.
- ServerName : ftp 서버 이름
- ServerType : ftp 데몬이 슈퍼데몬인 inetd에 의해 구동될 것인지 아니면, standalone방식으로 ftp를 구동할 것인지 선택합니다.
- DefaultServer : 기본 ftp로 설정
- Port : ftp 사용 포트를 지정합니다. 기본 21번을 사용합니다.
- Umask : 기본 022입니다.
- MaxInstances : 최대 자식 프로세스의 수를 지정합니다.
- User, Group : 사용자와 그룹을 지정합니다.
- UseReverseDNS : 접속한 IP 주소에 대한 Reverselookup 허용 여부
- IdentLookups : 일반적으로, 클라이언트가 ident protocol은 remote username의 허용 여부
- AuthPAMAuthoritative : PAM이 인증에 있어서 최종단계의 권한 수용 여부
- RootLogin : root의 ftp 접속 여부
- DenyFilter : 어떤 명령과도 매치가 되지 않는 정규 표현식을 지정. 이것은 proftpd로 오는 어떤 명령어 조합을 막는데 아주 유용합니다.
- DeferWelcome : Client가 인증에 성공할 때까지 server에 대한 정보를 전송 지연
- TimesGMT : GMT시각 사용 여부
- RateReadBPS : 주어진 설정부분에서 초당 전송 바이트 지정
- RateReadFreeBytes : 대역폭 제한 없이 전송되는 바이트 수
- RateReadHardBPS : RateReadFreeBytes에 지정된 양만큼 파일이 전송되면, RateReadBPS에 정해진 만큼 대역폭 사용
- TimeoutIdle : 접속자가 입력없이 연결을 유지할 수 있는 초 단위 최대시간
- TimeoutNoTransfer : 접속자가 파일을 주고 받거나, 디렉토리 목록을 받는 등의 연결 행위에 대한 입력없이 유지할 수 있는 초 단위 최대시간
- TimeoutLogin : Client가 인증을 유지할 수 있는 시간을 초 단위로 지정
- DisplayLogin : Login시 나타나는 메시지 지정
- DisplayFirstChdir : cd 명령으로 처음으로 디렉토리를 이동하였을 때 나타나는 메시지 지정
- <Directory /*>
AllowOverwrite on : 새로 생성될 파일로 덮어쓰기를 허용
</Directory>
[root@ns root]# /etc/rc.d/init.d/proftpd stop
Shutting down proftpd: Suspending NOW [확인]
[root@ns root]# /etc/rc.d/init.d/proftpd start
Allowing sessions again [ 확인 ]