ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • FTP
    linux/centOS 2018. 7. 20. 11:16

    ☆ FTP(File Transfer Protocol) 개요

     

    FTP (File Transfer Protocol) 파일 전송 프로토콜

     

    FTP는 인터넷상의 컴퓨터들간에 파일을 교환하기 위한 표준 프로토콜로서 가장 간단한 방법이기도 하다. 화면에 표시할 수 있는 웹 페이지와 관련 파일들을 전송하는 HTTP, 전자우편을 전송하는 SMTP 등과 같이, FTP 역시 인터넷의 TCP/IP 응용 프로토콜 중의 하나이다. FTP는 웹 페이지 파일들을 인터넷상에서 모든 사람이 볼 수 있도록 하기 위해 저작자의 컴퓨터로부터 서버로 옮기는 과정에서 사용된다. 또한, 다른 서버들로부터 자신의 컴퓨터로 프로그램이나 파일들을 다운로드 하는 데에도 많이 사용된다.

     

    사용자 입장에서는 간단한 명령을 이용하여 FTP를 쓰거나, 또는 그래픽 사용자 인터페이스를 제공하는 상용 프로그램을 쓸 수도 있다. 보통은 웹 브라우저도 웹 페이지로부터 선택한 프로그램을 다운로드 하는데 FTP를 사용한다. FTP를 사용하여 서버에 있는 파일을 지우거나 이름을 바꾸거나 옮기거나 복사하는 등 갱신작업을 할 수도 있다. FTP 서버에는 로그온을 해야하지만, 익명의 FTP를 사용하여 모든 사람들에게 공개된 파일들을 쉽게 접근할 수 있도록 하고 있다.

     

    FTP는 보통 TCP/IP에 함께 딸려오는 일련의 프로그램 속에 포함되어 있다.

     

     

    Anonymous FTP (anonymous File Transfer Protocol) ; 익명 FTP

     

    인터넷에서 FTP를 사용할 때 anonymous FTP는 사용자들이 서버에 자신을 식별시키지 않고서도 파일에 접근할 수 있는 방법을 제공한다. 보통의 FTP 사이트들은 오직 적법한 사용자 아이디와 패스워드를 가진 사람만이 이용할 수 있는데 반해, anonymous FTP는 파일을 보거나 다운로드하기 위해 해당 서버에서 부여된 사용자 아이디나 패스워드가 없더라도 작업이 가능하기 때문에 anonymous 라고 부른다.

     

    Anonymous FTP 서버에 접속한 뒤 사용자 아이디로 "anonymous" 라고 입력하고, 패스워드에는 자신의 이메일 주소를 입력하면 로그인이 허용된다 (이때, 패스워드를 넣지 않거나 어떤 내용을 넣더라도 로그인 하는데 문제가 없지만, 대개 자신의 이메일 주소를 쳐 넣는 것이 통신상의 예의로 되어있다).

     

     

     

    ☆FTP 프로그램의 종류

     

    리눅스에서 사용할수 있는 FTP 프로그램은 여러가지이다.

     

     wu-ftpd : 예전 RedHat Linux에서 사용하던 기본 FTP 프로그램

     vsftpd : 현재 많이 사용되고 있는 기본 FTP 프로그램

     proftpd : 현재 많이 사용되고 있는 기본 FTP 프로그램

     기타(gssftp, tftp, sftp...)

     

    (1) vsftpd, proftpd 프로그램의 차이점

     

    종류

    특징 설명

    vsftpd 특징

    UNIX 시스템에서 사용할 수 있는 Free FTP daemon

    리눅스, Solaris, HP, FreeBSD 등에 지원된다.

    보안부분을 특히 강조한 서버 데몬

    Redhat, SUSE, OPEN-BSD에서 기본 FTP 데몬으로 채택

    가상 IP 설정(Virtual IP Configuration)

    가상 유저 지원(Virtual Users)

    Standalon 또는 inetd(xinetd) 지원

    전송 대역폭 조절 기능(Bandwidth Throttling)

    환경설정파일을 IP별로 독립적인 지원(Per-source-IP Configurability)

    IP별 제한 기능(Per-source-IP Limits)

    IPv6 지원

    SSL을 사용한 암호화 지원(Encryption support through SSL integration)

    (vsftpd 사이트) http://vsftpd.beasts.org

    proftpd 특징

    UNIX 또는 UNIX 호환 OS를 위한 FTP daemon

    Apache web server의 설정 방식

    Apache“.htaccess”와 비슷한 각 디렉토리의 “.ftpaccess” 설정

    쉽게 설정할 수 있는 다중 가상 FTP 서버와 anonymous FTP 서비스

    시스템 부하에 따라 stand-alone 또는 inetd 의 선택적 운영

    shadow 암호 지원, 만료된 계정들 지원 포함

    (proftpd 사이트) http://www.proftpd.org

     

     

     

    ☆ vsFTP(Very Secure FTP) 개요 

     

     

    vsftpd is a GPL licensed FTP server for UNIX systems, including Linux. It is secure and extremely fast. It is stable. Don't take my word for it, though. Below, we will see evidence supporting all three assertions. We will also see a list of a few important sites which are happily using vsftpd. This demonstrates vsftpd is a mature and trusted solution.

     

    안정적이고 빠르며 보안이 강화된 FTPRedhat, Suse, Open-BSD등에서 기본으로 채택하는 FTP서버이다.

    기본 프로그램인 vsFTP 프로그램은 Standalone 방식으로 동작하고 있다.

    (주의) xinetd 방식의 서비스가 아니다. standalone 방식의 서비스이다.

     

     

    패키지: vsftpd

    ------ vsFTP Server -----

     

    vsftpd(20,21)

    /etc/vsftpd/vsftpd.conf

    - /home/<사용자> => 인증된 사용자 접속(EX: user01,fedora)

    - /var/ftp => 익명 사용자 접속 (EX: anonymous)

     

    -------------------------

     

    프로그램 : vsftpd

    데몬 & 포트 & 프로토콜 : /usr/sbin/vsftpd, 20/21, TCP

    주 설정 파일 : /etc/vsftpd/vsftpd.conf

    하위 설정 파일 : /etc/vsftpd/{user_list, ftpusers}

    스크립트 : /etc/init.d/vsftpd

     

    (1) vsftpd 프로그램 설치 및 설정 파일 확인

     

    ----- DNS Server -----         ----- WEB Server -----

          FTP Server

         (172.16.9.2XX)                (172.16.9.1XX)

    ----------------------         ----------------------

     

    [그림] 실습 구조(FTP Server)

     

    설치 확인

    # rpm -qa | grep vsftpd (# rpm -q vsftpd)

    vsftpd-2.0.5-16.el5_4.1

     

    (프로그램이 설치 되어 있지 않다면 설치)

    # vi /etc/resolv.conf

    # yum install vsftpd (# yum install vsftp*)

     

    패키지 정보 확인

    # rpm -ql vsftpd

    /etc/logrotate.d/vsftpd.log

    /etc/pam.d/vsftpd

    /etc/rc.d/init.d/vsftpd

    /etc/vsftpd

    /etc/vsftpd/ftpusers

    /etc/vsftpd/user_list

    /etc/vsftpd/vsftpd.conf

    /etc/vsftpd/vsftpd_conf_migrate.sh

    /usr/sbin/vsftpd

    /usr/share/doc/vsftpd-2.0.5

    /usr/share/doc/vsftpd-2.0.5/AUDIT

    /usr/share/doc/vsftpd-2.0.5/BENCHMARKS

    /usr/share/doc/vsftpd-2.0.5/BUGS

    /usr/share/doc/vsftpd-2.0.5/COPYING

    /usr/share/doc/vsftpd-2.0.5/Changelog

    /usr/share/doc/vsftpd-2.0.5/EXAMPLE

    /usr/share/doc/vsftpd-2.0.5/EXAMPLE/INTERNET_SITE

    /usr/share/doc/vsftpd-2.0.5/EXAMPLE/INTERNET_SITE/README

    /usr/share/doc/vsftpd-2.0.5/EXAMPLE/INTERNET_SITE/vsftpd.conf

    ..... (중략) .....

    /usr/share/doc/vsftpd-2.0.5/TODO

    /usr/share/doc/vsftpd-2.0.5/TUNING

    /usr/share/doc/vsftpd-2.0.5/vsftpd.xinetd

    /usr/share/man/man5/vsftpd.conf.5.gz

    /usr/share/man/man8/vsftpd.8.gz

    /var/ftp

    /var/ftp/pub

     

     

    vsftp 설치 폴더 확인 및 환경 설정 파일 확인

    # cd /etc/vsftpd

    # ls

    ftpusers user_list vsftpd.conf vsftpd_conf_migrate.sh

     

    vsftpd 관련 파일들

    파일종류

    설명

    /etc/vsftpd/vsftpd.conf

    vsftpd 프로그램의 주 설정 파일

    /etc/vsftpd/ftpusers

    vsftpd 서버에 접속할 수 없는 사용자 정의

    /etc/vsftpd/user_list

    vsftpd 서버에 접속할 수 없는 사용자 정의

    /var/ftp

    Anonymous FTP 사용자를 위한 디렉토리

     

    # cat /etc/vsftpd/ftpusers

    # Users that are not allowed to login via ftp

    root

    bin

    daemon

    adm

    lp

    sync

    shutdown

    halt

    mail

    news

    uucp

    operator

    games

    nobody

    -> 파일에 정의된 사용자는 FTP 서버에 접속할수가 없다.

     

    # cat /etc/vsftpd/user_list

    # vsftpd userlist

    # If userlist_deny=NO, only allow users in this file

    # If userlist_deny=YES (default), never allow users in this file, and

    # do not even prompt for a password.

    # Note that the default vsftpd pam config also checks /etc/vsftpd/ftpusers

    # for users that are denied.

    root

    bin

    daemon

    adm

    lp

    sync

    shutdown

    halt

    mail

    news

    uucp

    operator

    games

    nobody

    -> 파일에 정의된 사용자는 FTP 서버에 접속할 수 없다.

    (2) /etc/vsftpd/vsftpd.conf 파일 분석

     

    # cat /etc/vsftpd/vsftpd.conf

    1 # Example config file /etc/vsftpd/vsftpd.conf

    2 #

    3 # The default compiled in settings are fairly paranoid. This sample file

    4 # loosens things up a bit, to make the ftp daemon more usable.

    5 # Please see vsftpd.conf.5 for all compiled in defaults.

    6 #

    7 # READ THIS: This example file is NOT an exhaustive list of vsftpd options.

    8 # Please read the vsftpd.conf.5 manual page to get a full idea of vsftpd's

    9 # capabilities.

    10 #

    11 # Allow anonymous FTP? (Beware - allowed by default if you comment this out).

    12

    13 anonymous_enable=YES /* 익명 사용자의 접속을 가능하게 설정한다. */

    14 #anonymous_enable=NO

    15

    16 #

    17 # Uncomment this to allow local users to log in.

    18 local_enable=YES /* 로컬 사용자의 접속을 가능하게 설정한다. */

    19 #local_enable=NO

    20 #

    21 # Uncomment this to enable any form of FTP write command.

    22 write_enable=YES /* 로컬 사용자의 쓰기 기능을 가능하게 설정한다. */

    23 #

    24 # Default umask for local users is 077. You may wish to change this to 022,

    25 # if your users expect that (022 is used by most other ftpd's)

    26 local_umask=022 /* 로컬 사용자의 파일 생성시 적용될 umask 값을 설정한다. */

    27 #

    28 # Uncomment this to allow the anonymous FTP user to upload files. This only

    29 # has an effect if the above global write enable is activated. Also, you will

    30 # obviously need to create a directory writable by the FTP user.

    31 #anon_upload_enable=YES /* 익명 사용자의 파일 업로드를 가능하게 설정한다. */

    32

    33 anon_upload_enable=YES

    34

    35 #

    36 # Uncomment this if you want the anonymous FTP user to be able to create

    37 # new directories.

    38 #anon_mkdir_write_enable=YES /* 익명 사용자의 디렉토리 생성을 가능하게 설정한다. */

    39

    40 anon_mkdir_write_enable=YES

    41

    42 #

    43 # Activate directory messages - messages given to remote users when they

    44 # go into a certain directory.

    45 dirmessage_enable=YES /* 특정 폴더에 접속시 .message 파일의 메시지를 보여줄 것인지를 지정

    하는 설정이다. */

    46 #

    47 # Activate logging of uploads/downloads.

    48 xferlog_enable=YES /* 업로드/다운로드 로그를 xferlog에 기록하겠다는 설정이다. */

    49 #

    50 # Make sure PORT transfer connections originate from port 20 (ftp-data).

    51 connect_from_port_20=YES /* ftp 데이터 전송시 20번 포트 사용을 설정한다. */

    52 #

    53 # If you want, you can arrange for uploaded anonymous files to be owned by

    54 # a different user. Note! Using "root" for uploaded files is not

    55 # recommended!

    56 #chown_uploads=YES /* 익명 사용자가 업로드한 파일의 소유권을 변경할 때 설정한다. */

    57 #chown_username=whoever /* chown_uploads=YES일 경우 지정한 사용자 이름으로 익명 사용자가

    업로드한 파일의 소유자가 지정된다. */

    58 #

    59 # You may override where the log file goes if you like. The default is shown

    60 # below.

    61 #xferlog_file=/var/log/vsftpd.log /* 업로드/다운로드 로그파일을 지정한다. */

    62 #

    63 # If you want, you can have your log file in standard ftpd xferlog format

    64 xferlog_std_format=YES /* xferlog를 표준 로그포맷으로 기록한다. */

    65 #

    66 # You may change the default value for timing out an idle session.

    67 #idle_session_timeout=600 /* ftp접속의 타임아웃시간을 지정한다. (단위: ) */

    68 #

    69 # You may change the default value for timing out a data connection.

    70 #data_connection_timeout=120 /* 데이터 전송의 타임아웃시간을 지정한다. (단위: ) */

    71 #

    72 # It is recommended that you define on your system a unique user which the

    73 # ftp server can use as a totally isolated and unprivileged user.

    74 #nopriv_user=ftpsecure /* vsftpd 데몬을 루트가 아닌 시스템에 존재하는 일반 사용자의 비특권

    권한으로 동작시킨다. */

    75 #

    76 # Enable this and the server will recognise asynchronous ABOR requests. Not

    77 # recommended for security (the code is non-trivial). Not enabling it,

    78 # however, may confuse older FTP clients.

    79 #async_abor_enable=YES /* async_abor_enables 기능을 사용하겠다는 설정이다. */

    80 #

    81 # By default the server will pretend to allow ASCII mode but in fact ignore

    82 # the request. Turn on the below options to have the server actually do ASCII

    83 # mangling on files when in ASCII mode.

    84 # Beware that on some FTP servers, ASCII support allows a denial of service

    85 # attack (DoS) via the command "SIZE /big/file" in ASCII mode. vsftpd

    86 # predicted this attack and has always been safe, reporting the size of the

    87 # raw file.

    88 # ASCII mangling is a horrible feature of the protocol.

    89 #ascii_upload_enable=YES /* ASCII 모드로 업로드를 허락하겠다는 설정이다. */

    90 #ascii_download_enable=YES /* ASCII 모드로 다운로드를 허락하겠다는 설정이다. */

    91 #

    92 # You may fully customise the login banner string:

    93 #ftpd_banner=Welcome to blah FTP service. /* ftp 서버 접속시 안내메세지를 출력한다. */

    94 #

    95 # You may specify a file of disallowed anonymous e-mail addresses. Apparently

    96 # useful for combatting certain DoS attacks.

    97 #deny_email_enable=YES /* 익명사용자 접속시 패스워드를 e-mail형식으로 받겠다는 설정이다. */

    98 # (default follows)

    99 #banned_email_file=/etc/vsftpd/banned_emails /* 허용하지 않을 e-mail 주소를 파일에 넣어두면 접

    속이 안된다. (banned_emails파일 생성시) */

    100 #

    101 # You may specify an explicit list of local users to chroot() to their home

    102 # directory. If chroot_local_user is YES, then this list becomes a list of

    103 # users to NOT chroot().

    104

    105 chroot_local_user=YES /* 전체 사용자가 chroot 기능을 사용하도록 설정한다. */

    106

    107 #chroot_list_enable=YES /* chroot_list에 등록된 사용자만 chroot 기능을 사용하도록 설정한다. */

    108 # (default follows)

    109 #chroot_list_file=/etc/vsftpd/chroot_list /* chroot 기능을 사용할 사용자 리스트 파일을 지정한다. */

    110 #

    111 # You may activate the "-R" option to the builtin ls. This is disabled by

    112 # default to avoid remote users being able to cause excessive I/O on large

    113 # sites. However, some broken FTP clients such as "ncftp" and "mirror" assume

    114 # the presence of the "-R" option, so there is a strong case for enabling it.

    115 #ls_recurse_enable=YES /* ls -R(서브디렉토리 파일 목록 출력) 명령 사용여부를 설정한다. */

    116 #

    117 # When "listen" directive is enabled, vsftpd runs in standalone mode and

    118 # listens on IPv4 sockets. This directive cannot be used in conjunction

    119 # with the listen_ipv6 directive.

    120 listen=YES /* 단독 데몬일 경우 listen YES로 지정한다. */

    121 # listen=NO /* xinetd 로 설정할 경우 NO로 지정한다. */

    122 #

    123 # This directive enables listening on IPv6 sockets. To listen on IPv4 and IPv6

    124 # sockets, you must run two copies of vsftpd whith two configuration files.

    125 # Make sure, that one of the listen options is commented !!

    126 #listen_ipv6=YES

    127

    128 pam_service_name=vsftpd /* pam 사용자 인증 설정 */

    129 userlist_enable=YES /* userlist 사용을 허가하겠다는 설정이다. */

    130 # userlist_deny=NO /* userlist 에 등록된 사용자만 허가하겠다는 설정이다. */

    131 tcp_wrappers=YES /* tcp_wrappers 기능을 사용하겠다는 설정이다. (host, ip 차단) */

     

     

    (3) vsftpd 기본 설정 테스트

     

    FTP 서비스 확인

    # ftp localhost

    ftp: connect: Connection refused

    ftp> quit <------ quit 입력

    -> 프로그램이 설치는 되어 있지만, vsftpd 데몬이 동작하지는 않는 상태이다.

     

    FTP 서비스 시작 및 확인

     

    (현재) # service vsftpd restart

    (부팅) # chkconfig vsftpd on

     

    # service vsftpd restart

    Shutting down vsftpd: [FAILED]

    Starting vsftpd for vsftpd: [ OK ]

     

    # pgrep -lf vsftpd

    6450 /usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf

     

    # vsftpd -v (-v: Version)

    vsftpd: version 2.0.5

    -> vsftpd 프로그램의 버전이 2.0.5 버전을 사용하고 있다.

     

    # ftp localhost

    Connected to linuxXXX.example.com.

    220 (vsFTPd 2.0.5)

    530 Please login with USER and PASS.

    530 Please login with USER and PASS.

    KERBEROS_V4 rejected as an authentication type

    Name (localhost:root): root

    530 Permission denied.

    Login failed.

    ftp> quit

    221 Goodbye.

    -> root 사용자는 로그인이 가능하지 않는다.

     

    # ftp localhost

    Connected to linux240.example.com.

    220 (vsFTPd 2.0.5)

    530 Please login with USER and PASS.

    530 Please login with USER and PASS.

    KERBEROS_V4 rejected as an authentication type

    Name (localhost:root): fedora

    331 Please specify the password.

    Password:(사용자 암호 입력)

    230 Login successful.

    Remote system type is UNIX.

    Using binary mode to transfer files.

    ftp> dir

    227 Entering Passive Mode (127,0,0,1,106,173)

    150 Here comes the directory listing.

    226 Directory send OK.

    ftp> quit

    221 Goodbye.

    -> 일반사용자는 로그인이 가능하다.

     

    root 사용자로 FTP 서버에 접속할 수 있도록 설정

    # vi /etc/vsftpd/ftpusers

    # Users that are not allowed to login via ftp

    bin <----- 'root' 사용자 라인 삭제

    daemon

    adm

    lp

    sync

    shutdown

    halt

    mail

    news

    uucp

    operator

    games

    nobody

     

    # vi /etc/vsftpd/user_list

    # vsftpd userlist

    # If userlist_deny=NO, only allow users in this file

    # If userlist_deny=YES (default), never allow users in this file, and

    # do not even prompt for a password.

    # Note that the default vsftpd pam config also checks /etc/vsftpd/ftpusers

    # for users that are denied.

    bin <----- 'root' 사용자 라인 삭제

    daemon

    adm

    lp

    sync

    shutdown

    halt

    mail

    news

    uucp

    operator

    games

    nobody

     

    # ftp localhost

    Connected to linux240.example.com.

    220 (vsFTPd 2.0.5)

    530 Please login with USER and PASS.

    530 Please login with USER and PASS.

    KERBEROS_V4 rejected as an authentication type

    Name (localhost:root): root

    331 Please specify the password.

    Password: (root 사용자 암호 입력)

    230 Login successful.

    Remote system type is UNIX.

    Using binary mode to transfer files.

    ftp> dir

    227 Entering Passive Mode (127,0,0,1,161,241)

    150 Here comes the directory listing.

    drwxr-xr-x 2 0 0 4096 Mar 08 01:07 Desktop

    drwxr-xr-x 2 0 0 4096 Apr 01 2010 bin

    drwxr-xr-x 2 0 0 4096 Feb 24 17:17 logs

    -rw------- 1 0 0 14827 Mar 03 22:37 mbox

    drwxr-xr-x 2 0 0 4096 Mar 08 00:24 test

    226 Directory send OK.

    ftp> quit

    221 Goodbye.

     

    (결론) vsftpd 서비스가 실행되면

    - (일반사용자)/etc/vsftpd/ftpusers, /etc/vsftpd/user_list 파일에 등록이 되어 있지 않기 때문에

    FTP 로그인이 가능하다.

    - (root 사용자)/etc/vsftpd/ftpusers, /etc/vsftpd/user_list 파일에 등록에 등록 되어 있기 때문에

    FTP 로그인이 가능하지 않다. 이런 경우 두개의 파일에서 root 라인을 삭제하면 된다.

    하지만, 이 설정은 실무에서는 권장하지 않는다. root 사용자로 로그인 하는 것은 보안상 좋지 않다.

     

     

     

    (4) /etc/vsftpd/ftpusers, /etc/vsftpd/user_list 파일 테스트

     

    -----> /etc/vsftpd/ftpusers -> /etc/vsftpd/user_list ----->

    user01 (X) -----> Login incorrect (Login Fail)

    (X) user01 -----> Permission denied (Login Fail)

    (X) (X) -----> Login successful (Login Success)

     

    /etc/vsftpd/ftpusers 파일에 user01 사용자 등록 및 점검

     

    (전제 조건) user01, user02 사용자가 존재 해야 한다.

    # grep user /etc/passwd

    # useradd <사용자이름> (EX: # useradd user01)
    # passwd <사용자이름> (EX: # passwd user01)

    # vi /etc/vsftpd/ftpusers

    ..... (중략) .....

    games

    nobody

    user01 <----- 마지막 라인에 사용자 추가

    -> 한개의 라인에 한명의 사용자를 정의한다. 한개의 라인에 여러명의 사용자 이름을 지정할 수 없다.

    # ftp localhost

    Connected to linuxXXX.example.com.

    220 (vsFTPd 2.0.5)

    530 Please login with USER and PASS.

    530 Please login with USER and PASS.

    KERBEROS_V4 rejected as an authentication type

    Name (localhost:root): user01

    331 Please specify the password.

    Password: (사용자 암호 입력)

    530 Login incorrect. <----- '2~3 초 정도 기다린다.'

    Login failed.

    ftp> quit

    221 Goodbye.

    -> 접속이 되지 않는다.

     

    /etc/vsftpd/ftpusers 파일의 추가 내용 삭제, /etc/vsftpd/user_list

    # vi /etc/vsftpd/ftpusers

    -> 추가 되었던 user01 사용자 라인 삭제

     

    # vi /etc/vsftpd/user_list

    ..... (중략) .....

    games

    nobody

    user01 <----- 새로운 라인 추가

     

    # ftp localhost

    Connected to linuxXXX.example.com.

    220 (vsFTPd 2.0.5)

    530 Please login with USER and PASS.

    530 Please login with USER and PASS.

    KERBEROS_V4 rejected as an authentication type

    Name (localhost:root): user01

    530 Permission denied.

    Login failed.

    ftp> quit

    221 Goodbye.

     

    /etc/vsftpd/user_list 파일의 추가 내용 삭제

    # vi /etc/vsftpd/user_list

    -> 추가 되었던 user01 사용자 라인 삭제

     

    # ftp localhost

    Connected to linuxXXX.example.com.

    220 (vsFTPd 2.0.5)

    530 Please login with USER and PASS.

    530 Please login with USER and PASS.

    KERBEROS_V4 rejected as an authentication type

    Name (localhost:root): user01

    331 Please specify the password.

    Password: (사용자 암호 입력)

    230 Login successful.

    Remote system type is UNIX.

    Using binary mode to transfer files.

    ftp> quit

    221 Goodbye.

     

     

     

    (5) (GUI) gftp 툴 사용

     

    FTP 서버에 접속하는 클라이언트 프로그램

    - (GUI) # gftp &

    - (TUI) # ftp <IP> <PORT>

     

     

     

    (5-1) gftp(GNU FTP) 패키지 사용

    (주의) yum 프로그램 사용할 때는 /etc/resolv.conf 파일의 내용 중 nameserver 키워드 다음에는 정상적으로 동작

    하는 DNS 서버를 지정하고 있어야 한다.

    # cat /etc/resolv.conf

    search linuxXXX.example.com

    nameserver 168.126.63.1

     

    # rpm -qa | grep gftp (# rpm -q gftp)

    # yum install gftp (# yum -y install gftp)

    ..... (중략) ......

    Dependencies Resolved

     

    =================================================================================================

    Package Arch Version Repository Size

    =================================================================================================

    Installing:

    gftp i386 1:2.0.18-3.2.2 base 939 k

     

    Transaction Summary

    =================================================================================================

    Install 1 Package(s)

    Update 0 Package(s)

    Remove 0 Package(s)

     

    Total download size: 939 k

    Is this ok [y/N]: y <----- 'y' 입력

    Downloading Packages:

    gftp-2.0.18-3.2.2.i386.rpm | 939 kB 00:00

    Running rpm_check_debug

    Running Transaction Test

    Finished Transaction Test

    Transaction Test Succeeded

    Running Transaction

    Installing : gftp 1/1

     

    Installed:

    gftp.i386 1:2.0.18-3.2.2

     

    Complete!

    -> 패키지는 CD 안에도 있기 때문에, CD안에서 설치해도 된다.

     

     

    (5-2) (TUI) ftp 명령어 사용

     

    (명령어 사용법)

    # ftp <IP> (EX: # ftp 172.16.9.252)

    # ftp <IP> <PORT> (EX: # ftp 172.16.9.252 21)

     

     

    # ftp 172.16.9.252

    사용자로 로그인

    () 업로드/다운로드 포인터 맞추기(cd/lcd)

    () 편리한 기능 설정(bin/hash/prompt)

    () 업로드/다운로드(mget/mput/get/put)

    () 확인/해제(ls/dir/bye/quit)

     

    (Upload 실습)

          (linuxXXX)                          (linux252)

    ----- 172.16.9.XXX -----            ----- 172.16.9.252 -----

     

    # ftp 172.16.9.252

     

    /root/linux2XX.txt(1M) ---------->   /tmp/linux2XX.txt

     

    실습준비

    # cd /root

    # dd if=/dev/zero of=linux2XX.txt bs=1M count=1

    /* if : input file, of : output file, bs : block size */

    # ls -lh /* -h : human */

     

    FTP 서버 접속

    # ftp 172.16.9.252

    root 사용자로 접속

     

    업로드/다운로드 포인터 맞추기

    ftp> help

    ftp> help lcd

     

    ftp> cd /tmp /* cd : change directory */

    ftp> lcd /root /* lcd: local change directory */

     

    편리한 기능 설정

    ftp> bin /* 전송모드: binary, ascii * 바이너리 파일형식으로 전송/

    ftp> hash /* 파일전송: Hash(#) 표시 * 4k마다 1자리 표시/

    ftp> prompt /* 대화형모드 ON/OFF * /

     

    전송 모드(Transmission Mode)

    File(ASCII) ----- ASCII ----->

    File(BINARY)----- BINARY ---->

     

    해쉬 표시(Hash)

    File(500M) --------4K(#)---->

     

    대화형 모드 on/off

    File1, File2 ----------------> (y/n)?

    File3, File4

     

    업로드/다운로드

    ftp> put linuxXXX.txt

    ftp> get linuxXXX.txt

     

    ftp> mput linux* (mput: Multiful put)

    ftp> mget linux* (mget: Multiful get)

     

    확인/해제

    ftp> ls (ls or dir)

    ftp> !ls (>!CMD)

     

    ftp> quit (quit or bye)

    #

    (Download 실습)

    ----- 172.16.9.XXX -----    ----- 172.16.9.252 -----

     

      # ftp 172.16.9.252

     

      /test/linux2XX.txt(1M)  <---------- /tmp/linux2XX.txt

     

    실습준비

    # mkdir -p /test

     

    FTP 서버 접속

    # ftp 172.16.9.252

    root 사용자로 접속

     

    업로드/다운로드 포인터 맞추기

    ftp> help

    ftp> help lcd

     

    ftp> cd /tmp

    ftp> lcd /test

     

    편리한 기능 설정

    ftp> bin

    ftp> hash

    ftp> prompt

     

    업로드/다운로드

    ftp> dir linux*

     

    ftp> put linux2XX.txt

    ftp> get linux2XX.txt

     

    ftp> mput linux* (mput: Multiful put)

    ftp> mget *2XX* (mget: Multiful get)

     

    확인/해제

    ftp> ls

    ftp> !ls (>!CMD)

     

    ftp> bye

    #

     

     

    [참고] Windows FTP Client <---> Linux(CentOS 5.X) FTP Server

    <CTRL + ESC> => "cmd" 입력 => <ENTER>

    C:\Users\soldesk> cd C:\

    C:\Users\soldesk> cls

    C:> ftp 172.16.9.2XX

    root 사용자로 로그인

    ftp> cd /root

    ftp> lcd c:\ (ftp> lcd d:\test)

     

    ftp> bin

    ftp> hash

    ftp> prompt

     

    ftp> mget linux*

    ftp> quit

    C:> dir | more

    C:> exit

    -> C:\linuxXXX.txt 파일 확인

     

    'linux > centOS' 카테고리의 다른 글

    웹 서버  (0) 2018.07.18
    DNS 서버 2  (0) 2018.07.17
    DNS 서버 1  (0) 2018.07.12
    네트워크 설정  (0) 2018.07.11
    centos  (0) 2018.07.10

    댓글

Designed by Tistory.