본문 바로가기

Linux

[슈퍼유저] FTP 서버

 
리눅스가 6.1로 변화하면서 anonymous ftp 서버가 proftpd로 변경되었다. 
이 proftpd는 standalone형으로 사용자들의 편의를 많이 제공한다. 이번 장에서는 
알짜 레드햇 6.1 ftp서버를 바탕으로 proftp서버에  대해 알아 보도록 하겠다.

$1. Linux FTP설치/설정

1)Linux FTP설치

anonymous ftp가 설치 되어 있지 않다면 여러분은 다음의 두 파일을 다운 받아 
설치 해야 한다.

-anonftp-2.9-4ac.i386.rpm
-proftpd-1.2.0pre9-3ac.i386.rpm

이 파일 중에서anonyftp는 /home/ftp라는 디렉토리를 만들고 기본적인 ftp가
운용되도록 설정을 해주는 것이며 profptd는 anonymous로 접속하는 사용자들을 
제어하고  anonymous서비스를 제공하는  ftp서버 프로그램이다.
이 두파일을 설치한 다음에 몇 가지만 설정해 주면 여러분의 컴퓨터는 
anonymous ftp서버의 기능을 수행하게 된다. 앞에서도 proftpd는 말했듯이  
standalone으로 동작한다. 만약 여러분이 이 파일을설정한 다음, ftp로 접속하면 
다음과 같은 오류가 날수도 있다.

[root@rootshell /root]# ftp localhost
    connected to localhost.
    compiled-in modules:
    ftp>

이는 /etc/inetd.conf의 파일에 다음과 같은 줄을 제거해주어야 한다.

[root@rootshell /root]#vi /etc/inetd.conf
    
이부분을 제거=> ftp stream tcp nowait root /usr/sbin/tcpd in.ftpd -l -a
    
그러나 대부분의 사람들은 리눅스를 설치하면서 자동으로 ftp서버가 설치되어 
있을 것이다.
    
위의 파일은 요기 에서 다운 받을 수 있다.
    
(참고)앞으로 여러분들은 이러한 사이트에서 다운을 많이 받게 될텐데 초보때는 
실제로 방문을 해도 어떤 것을 다운 받아야 할지 애매할 때가 많다. 
그래서 다운을 받는 방법을 간단하게 소개하고자 한다.

xxxxxxxxx.tar.gz     
요거는 gz으로 압축된 파일이다. 주로 리눅스상에서 압축을 풀고 사용한다.
xxxxxxxxx.src.rpm    
요거는 소스rpm파일이다. 소스 내용을 일부 수정해서 사용할 수 있다.
xxxxxxxxx.i386.rpm   
요거는 소스 내용을 수정할 수 없는 패키지이다. i386은 인텔 i386호환기종을 말한다.
대부분의 시스템들이 인텔 호한칩을 사용하고 있으므로 요걸 다운 받는다.

2)Linux FTP설정

ftp서버도 마찬가지이다. conf파일만 수정하는 것으로 바로 운용이 가능하다.

다음 파일은 /etc/proftpd.conf의 내용이다.

[root@rootshell /root]#vi /etc/proftpd.conf

# 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	        "dacker.net"
ServerType	        standalone
DefaultServer              on

여기서 Server Name은 여러분의 ftp서버명을 말한다.
또한 서버타입은 standalone으로 하는 것이 슈퍼데몬(inetd)에 영향을 주지 않고 좋다.

# Use Pam Module (required /etc/pam.d/ftp)
# please read /usr/doc/proftpd-1.2pre3/mod_pam.c
#
AuthPAMAuthoritative           on
사용자 인증에서 PAM을 사용할 것인지를 명시
# Port 21 is the standard FTP port.
Port				21
기본 포트번호 21 반드시 외워라
# Umask 022 is a good standard umask to prevent new dirs and files
# from being group and world writable.
Umask				022
파일을 생성하게 되면 기본적으로 주어지는 퍼미션을 umask라 한다.
022라고 설정 되어 있다면 퍼미션 644(-rw-r--r--)을 뜻한다.

# 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
자식 프로세스 최대 생성수지정. 바람직하지 못한 서비스 
공격 방지 , 수 초과시 log기록 연결 해제
# Set the user and group that the server normally runs at.

User				nobody
Group				nobody

proftpd 데몬을 실행시키는 사용자와 그룹 설정
# To show all filenames including ``dot'' files
#LsDefaultOptions "-a"

#
# To allow root login
#  be sure to take root out from /etc/ftpusers also :)
#
#RootLogin on
RootLogin off
root 계정으로 로그인, 보안에 좋지 않음 항상off로 해놓을 것

# Normally, we want files to be overwriteable.

  AllowOverwrite		on
  새로운 파일명이 기존의 파일명과 같을 경우 덮어쓰기 허용


# A basic anonymous configuration, no upload directories.


  User				ftp
  Group				ftp
  RequireValidShell             off
익명사용자로 접근 가능 설정
# We want clients to be able to login with "anonymous" as well as "ftp"
UserAlias			anonymous ftp
anonymous,ftp로 로그인 가능

# Limit the maximum number of anonymous logins
MaxClients			10 
매직 쿠기이용 메세지 삽입가능
("죄송합니다. 현재 사용인원은 %M입니다. 다음을 이용해 주십시요")
최대 접속가능 클라이언트 제한 none으로 설정하면 무제한 접속가능

# Limit the maximum number per host
# MaxClientsPerHost          1
동일한 사용자가 접속을 끊고 제접속할 수 있는 횟수
# We want 'welcome.msg' displayed at login, and '.message' displayed
# in each newly chdired directory.
  
  DisplayLogin			welcome.msg
로그인시 보여줄 문서 파일 welcome.msg

  DisplayFirstChdir		.message

디렉토리 이동시 보여줄 문서 파일 .message
# Limit WRITE everywhere in the anonymous chroot
  
    DenyAll
  
 익명사용자 쓰기금지 설정
# Upload directory, allow upload and mkdir and deny download
#
# 
#   
#     DenyALL
#   
#   
#     AllowALL
#   
# 
  업로드 디렉토리 생성시 다운로드 금지, 업로드 디렉토리 
생성 가능 설정


자 설정이 끝났으면 데몬을 재실행하자(윈도우에서 프로그램 설치 후 리부팅하는 
것을 기억하는가
리눅스에서는 데몬에 관한 내용을 설정 후 데몬을 재 실행 시켜야만 한다.)
[root@rootshell /root]# /etc/rc.d/init.d/proftpd stop
shutting down ProFTPD                                 [ok]
[root@rootshell /root]# /etc/rc.d/init.d/proftpd start
starting ProFTPD                                      [ok]


이것으로 여러분들의 FTP서버의 설정이 끝났다. 자 이제 여러분들의 FTP서버에 
접속해 보자.
[root@rootshell /root]# ftp xxx.xxx.xxx.xxx
Connected to xxx.xxx.xxx.xxx
220 FTP Server''''''''

축하한다. 여러분은 이제 ftp서버를 운영중이고 자료를 올려 다운받게 할 수 도 
있는 것이다.

'Linux' 카테고리의 다른 글

[슈퍼유저] 클러스터(Cluster)  (0) 2013.09.26
[슈퍼유저] DNS서버  (0) 2013.09.26
[슈퍼유저] cron을 이용한 스케줄 작업  (0) 2013.09.26
[슈퍼유저] apm 설치  (0) 2013.09.26
[슈퍼유저] 네트워크설정  (0) 2013.09.26