[질문]ftp시 passive mode에 관해

kimdy123의 이미지

현재 linux8.0[redhat]에서 회사 HP 에 ftp 2xx.2xx.1xx.6x 하면
login과 passwd치면 ftp는 성공합니다 그런데 ls를 치면
passive mode라고 뜨면서 계속 있다가 Connection time out
이런 메세지가 뜨는데 어떻게 해줘야 하는지요.
telnet는 잘돼는데 ftp만 하면 이런현상이 답변좀 주시면
감사드리겠습니다. 좋은 주말 돼세요.
==========================================
[localhost 6] kimdy > ftp 2xx.2xx.1xx.6x
Connected to 2xx.2xx.1xx.6x (2xx.2xx.1xx.6x).
220 acadhp01 FTP server (Version 1.7.212.1 Thu May 9 21:10:27 GMT 1996) ready.
Name (211.241.151.61:kimdy): ID
331 Password required for ID.
Password:
230 User ID logged in.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> bin
200 Type set to I.
ftp> ls
227 Entering Passive Mode (192,168,1,45,7,81)
ftp: connect: Connection timed out
ftp>
=================================================

dotri의 이미지

로그인한 후에 PASS 명령을 내려서 클라이언트가 Passive 모드로 동작하도록 해줘야 합니다.

pynoos의 이미지

ftp의 원리를 잘 이해하셔서 환경을 debugging해보세요.

ftp는 기본적으로 control channel 과 data channel로 나뉩니다.
data channel은 directory list와 file 송수신용으로 사용되죠.

control channel은 사용자가 client 로 작동되는 channel이며,
data channel은 passive mode 상태에서는 사용자가 client로 작동하지만
passive mode off 인상태에서는 사용자가 server로 작동합니다.

즉, passive mode 는 전 channel이 client로 작동하는 mode이라 할 수 있죠.

접속을 tuple로 표현할때, (client ip, client port, server ip, server port)로 표현한다고 하면,
control channel [server listen]: (client ip, any port, server ip, 21)
passive mode off [client listen]: (client ip, selected port, server ip, 20)
passive mode on [server listen]: (client ip, any port, server ip, selected port)

이런 모습이 됩니다.

예상되는 현상을 살펴보면,
만약 ftp server 가 21번 port만을 열어 놓은 firewall 안에 있다면, passive mode로 접속은 불가능 합니다.
임의로 ftp server가 port를 선택한 data channel의 selected port를 firewall이 다 이해하는 정도가 아니라면요.

따라서, 대개 firewall 안으로 ftp 를 접속해 들어 갈경우는 passive mode off 로 접속하지요.

만약 ftp client가 임의의 사용자 서비스 제한시키는 firewall 안에 있다면, ftp client가 server가 되는,
심지어 그 port 마저 임의로 선택되는 data channel은 ftp 서버에서 접속할 수가 없게 됩니다.
이 경우에는 ftp client는 passive mode on (full client mode)로 바깥에 있는 서버에 접속해야 가능합니다.

위를 잘 살펴보시면 passive mode off인 상황에서 server의 data channel 접속은 20 번으로 고정하여 밖으로 나가는 것을 볼 수 있습니다.
이것은 다른 서비스에서는 흔히 볼수 없는 방법인데요,
대개 client의 port는 임의로 선택되는 반면 ftp server의 data channel은 passive mode off인 경우에 한해서 ftp server의 data channel client port가 20번으로 고정되고,
ftp client 의 data channel listen port가 임의로 됩니다.

따라서 정교한 firewall setting에서는 client 의 port가 20 번인경우를 확인하는 설정을 할 수도있습니다. (하지만 거의 없으니 무시하셔도 좋을 듯..)

kimdy123님의 error를 보면 passive mode로 들어가면서 접속이 되지 않는 것으로보아,
서버에 접속하는 경로중에 21번만을 통과시키는 firewall 이 있는 것 같습니다.

많은 ftp client가 passive 라는 명령으로 상태를 전환 시킬 수 있으므로, 바꿔서 시도해보시지요.

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.