가장 많이 쓰고 있는 proftpd를 사용해서 FTP 서버를 만들어 볼 것이다.
설치하기 전에
- Redhat 9 을 기준으로 작성한 문서이기 때문에 Redhat 9 을 설치되어 있어야 한다.
- proftpd 를 http://www.proftpd.org 에서 최신버전을 다운로드 받는다. 여기서는 1.2.9 를 받았다.
설치하기
아래처럼 간단하게 설치한다.
#tar xzvf proftpd-1.2.9.tar.gz #cd proftpd-1.2.9 #./configure --prefix=/usr/local/program/proftpd #make #make install
앞의 과정을 간단하게 설명하면, 압축을 풀어서 /usr/local/program 아래 proftpd 디렉토리에 설치하겠다는 설정을 해줬다. 그 뒤에 컴파일을 하고 설치를 했다.
설정하기
설치만 끝났다고, FTP 서버가 돌아가는 것은 아니다. 자기에 맞게 세팅을 해주어야 한다.
proftpd의 경우 proftpd.conf 에다가 설정을 해줘야 한다. /설치한 디렉토리/etc 아래에 있을 것이다.
여기서는 나의 설정에 맞게 설정하는 예를 보이겠다. 각자 자신의 맞게 세팅을 해주도록 한다.
# This is a basic ProFTPD configuration file (rename it to # 'proftpd.conf' for actual use. It establishes a single server # and a single anonymous login. It assumes that you have a user/group # "nobody" and "ftp" for normal operation and anon. ServerName "ProFTPD Default Installation" ServerType standalone # standalone 또는 inetd 중에 선택 DefaultServer on # Port 21 is the standard FTP port. Port 21 # Umask 022 is a good standard umask to prevent new dirs and files # from being group and world writable. Umask 022 # To prevent DoS attacks, set the maximum number of child processes # to 30. If you need to allow more than 30 concurrent connections # at once, simply increase this value. Note that this ONLY works # in standalone mode, in inetd mode you should use an inetd server # that allows you to limit maximum number of processes per service # (such as xinetd). MaxInstances 30 # Set the user and group under which the server will run. User nobody Group nobody # 이 부분을 수정 # To cause every FTP user to be "jailed" (chrooted) into their home # directory, uncomment this line. #DefaultRoot ~ # Normally, we want files to be overwriteable. <Directory /> AllowOverwrite on </Directory> # A basic anonymous configuration, no upload directories. If you do not # want anonymous users, simply delete this entire <Anonymous> section. <Anonymous ~ftp> User ftp Group ftp # We want clients to be able to login with "anonymous" as well as "ftp" UserAlias anonymous ftp # Limit the maximum number of anonymous logins MaxClients 10 # We want 'welcome.msg' displayed at login, and '.message' displayed # in each newly chdired directory. DisplayLogin welcome.msg DisplayFirstChdir .message # Limit WRITE everywhere in the anonymous chroot <Limit WRITE> DenyAll </Limit> </Anonymous>
위에서의 설정은 proftpd 가 돌아가기위해 최소한의 설정을 보여주었다.
실행 및 테스트
간단히 아래와 같은 절차로 해서 실행할 수 있다.
#cd /usr/local/program/proftpd/sbin #./proftpd #ftp localhost Connected to localhost (127.0.0.1). 220 ProFTPD 1.2.9 Server (ProFTPD Default Installation) [localhost.localdomain] Name (localhost:root):
위와 같이 접속 프롬프트가 뜨면 제대로 돌아간다고 생각하면 된다.
그 외
위에서는 standalone 으로 설정을 해주었다. 만일 inetd 로 설정을 한다면, 부가적인 작업이 더 필요하다.
#cd /etc/xinetd.d #vi proftpd
다음의 내용을 입력한다.
# default: on # description: The ProFTPD FTP server service ftp { flags = REUSE socket_type = stream wait = no user = root server = /usr/local/program/proftpd/sbin/proftpd log_on_failure += USERID disable = no }
맺음말
위에서 다룬 proftpd.conf 은 가장 기본적인 설정이다. 좀더 세부적인 설정이 필요하다면, http://proftpd.oops.org/ 에 가보길 추천한다.