ftp 명령어 (AIX 5.3·6.1)
https://archive.horanglab.com/posts/aix-cmd-ftp
핵심 정리
- FTP로 로컬과 원격 호스트 사이, 또는 원격 호스트 두 대 사이에 파일을 주고받습니다.
ftp 호스트로 접속하면 사용자 이름과 비밀번호를 묻고ftp>프롬프트가 나옵니다. - 자주 쓰는 하위 명령:
get·put(파일 하나),mget·mput(여러 개),ls·dir,cd·lcd,binary·ascii(전송 형식),prompt(여러 파일 확인 끄기),hash(진행 표시),passive,bye. - 바이너리 파일(tar, 실행 파일 등)은 꼭
binary로 보냅니다. 기본은ascii라 줄바꿈이 바뀌어 파일이 깨질 수 있습니다. $HOME/.netrc(권한 600)에 접속 정보와 매크로를 두면 자동 로그인과 무인 전송을 할 수 있습니다.-n은 자동 로그인을 막습니다.- FTP는 비밀번호와 데이터를 평문으로 보냅니다. 6.1의
-s(TLS)나scp·sftp(OpenSSH)를 쓰는 것이 안전합니다. 파일 권한과 하위 디렉터리를 그대로 옮겨야 하면rcp나scp -rp를 씁니다.
| 항목 | 내용 |
|---|---|
| 버전 | AIX 5.3, AIX 6.1 (6.1에서 -s(TLS), -H(감사 로그), -M(전송 뒤 멈춤 방지)과 TLS 구성 파일 $HOME/.ftpcnf, Active Directory 비밀번호 안내가 더해짐) |
| 원문 | IBM Commands Reference — 5.3 Volume 2, 6.1 Volume 2 |
| 파일 | /usr/bin/ftp, $HOME/.netrc, $HOME/.ftpcnf(6.1), /usr/samples/tcpip/netrc, /etc/syslog.conf |
| 관련 명령어 | ftpd, rcp, scp, sftp, tftp, telnet |
목적
로컬 호스트와 원격 호스트 사이에 파일을 주고받습니다.
영어 원문
Transfers files between a local and a remote host.
구문
ftp [ -d ] [ -D DataConnTimeOut ] [ -g ] [ -i ] [ -n ] [ -v ] [ -f ] [ -K ] [ -k realm ] [ -q ] [ -C ]
[ -s ] [ -M ] [ HostName [ Port ] ] [ -H ]
-s, -M, -H는 6.1 구문에만 있습니다.
설명
ftp 명령은 FTP(File Transfer Protocol)로 로컬 호스트와 원격 호스트, 또는 원격 호스트 두 대 사이에 파일을 주고받습니다. ftp 명령을 원격으로 실행하는 것은 권하지 않습니다.
FTP 프로토콜은 파일 시스템이 서로 다른 호스트 사이에서도 데이터를 옮길 수 있습니다. 데이터 전송은 유연하지만 특정 파일 시스템의 파일 속성(보호 모드, 수정 시각 등)은 보존하지 않습니다. 또 파일 시스템의 전체 구조를 거의 가정하지 않으며, 하위 디렉터리를 재귀로 복사하는 기능도 없습니다.
참고: 파일 속성을 보존하거나 하위 디렉터리를 재귀로 복사해야 하면 rcp 명령을 씁니다.
하위 명령 입력
ftp> 프롬프트에서 원격 디렉터리 나열, 로컬·원격 현재 디렉터리 바꾸기, 여러 파일 한 번에 전송, 디렉터리 만들기·지우기, 로컬 셸로 나가 명령 실행 같은 하위 명령을 입력합니다.
HostName 없이 실행하면 바로 ftp> 프롬프트를 보여 주고 하위 명령을 기다립니다. 원격 호스트에 연결하려면 open 하위 명령을 씁니다. 연결되면 로그인 이름과 비밀번호를 물은 뒤 다시 ftp>를 보여 줍니다. 원격 호스트에 그 로그인 이름의 비밀번호가 정의되어 있지 않으면 실패합니다.
ftp 명령 해석기는 다른 파일 전송 프로그램에 없는 기능을 제공합니다.
- 하위 명령의 파일 이름 매개변수 처리
- 여러 하위 명령을 하나의 매크로로 묶기
$HOME/.netrc파일에서 매크로 읽기
이 기능으로 반복 작업을 줄이고 ftp를 무인 모드로 쓸 수 있습니다.
파일 이름 매개변수는 다음 규칙으로 처리합니다.
- 매개변수가
-이면 읽을 때는 표준 입력, 쓸 때는 표준 출력을 씁니다. - 그렇지 않고 파일 이름 확장(globbing)이 켜져 있으면(
-g플래그,glob하위 명령) C 셸 규칙으로 확장합니다. 파일 이름 하나를 받는 하위 명령에 패턴 문자를 쓰면 결과가 예상과 다를 수 있습니다. 예를 들어append와put은 확장한 뒤 첫 번째 이름만 쓰고,cd,delete,get,mkdir,rename,rmdir은 확장하지 않고 패턴 문자를 글자 그대로 씁니다. get,put,mget,mput에서는 로컬과 원격의 파일 이름 형식을 바꿔 대응하고(case,ntrans,nmap), 로컬 파일 이름이 겹치면 바꿀 수 있습니다(runique). 원격ftpd에 원격 파일 이름이 겹치면 바꾸라고 할 수도 있습니다(sunique).- 공백이 있는 매개변수는 큰따옴표로 감쌉니다.
참고: ftp 해석기는 파이프를 지원하지 않으며, 멀티바이트 문자 파일 이름을 모두 지원하지는 않습니다.
대화형으로 쓰다가 세션을 끝내려면 ftp>에서 quit나 bye, 또는 Ctrl+D를 입력합니다. 전송을 도중에 멈추려면 인터럽트 키(기본 Ctrl+C, stty로 바꿈)를 누릅니다.
보내는 전송(로컬에서 원격으로)은 바로 멈춥니다. 받는 전송(원격에서 로컬로)은 원격 FTP 서버에 FTP ABOR 명령을 보내고 서버가 보내기를 멈출 때까지 들어오는 패킷을 버립니다. 원격 서버가 ABOR를 지원하지 않으면 요청한 파일을 다 받을 때까지 ftp>가 나오지 않습니다. 원격 서버가 이상하게 동작하면 로컬 ftp 프로세스를 끝내야 할 수도 있습니다.
보안과 자동 로그인
인증 방법이 Standard일 때:
ftp는 원격 호스트에 비밀번호를 보내 보안을 처리하고, 자동 로그인·파일 전송·로그오프를 할 수 있습니다.
HostName을 주면 그 호스트에 연결을 시도합니다. 연결되면 현재 디렉터리나 홈 디렉터리에서 $HOME/.netrc 파일을 찾고, 있으면 그 호스트의 로그인 항목과 명령 매크로 정의를 찾습니다. .netrc나 자동 로그인 항목이 없거나 시스템이 securetcpip로 보안 처리되어 있으면 사용자 이름과 비밀번호를 묻습니다. HostName을 주었든 아니든 이 프롬프트가 나옵니다.
참고: 큐잉 시스템은 멀티바이트 호스트 이름을 지원하지 않습니다.
.netrc에 자동 로그인 항목이 있으면 그 정보로 로그인하고, 항목에 정의된 명령 매크로도 읽습니다. 항목에 비밀번호가 없는 경우처럼 필요하면 ftp>를 보여 주기 전에 비밀번호를 묻습니다. 자동 로그인을 마치면, 항목에 init 매크로가 있으면 실행합니다. init 매크로가 없거나 그 안에 quit·bye가 없으면 ftp>를 보여 주고 하위 명령을 기다립니다.
참고: 프롬프트나 .netrc로 준 원격 사용자 이름은 원격 호스트에 있고 비밀번호가 정의되어 있어야 합니다. 아니면 실패합니다.
인증 방법이 Kerberos 5일 때:
IETF 초안 "draft-ietf-cat-ftpsec-09.txt"의 FTP 보안 확장을 GSSAPI(RFC 1508, 1509) 보안 메커니즘으로 씁니다. GSSAPI는 아래 보안·통신 메커니즘과 상관없는 서비스를 제공합니다. ftp는 AUTH와 ADAT 명령으로 ftpd와 인증하며, 둘 다 Kerberos를 지원하면 로컬 사용자의 DCE 자격 증명으로 원격 시스템에서 인증합니다. 실패하고 두 시스템 모두 Standard 인증이 구성되어 있으면 위의 방법을 씁니다.
HostName은 파일을 주고받을 호스트 이름이고, 선택인 Port는 전송할 포트입니다(기본 포트는 /etc/services에 있음).
(6.1) 참고: 레지스트리 값이 현재 인증 방식으로 올바르게 정해져 있으면 FTP 인증이 Active Directory 비밀번호로 동작합니다. 레지스트리 값이 null이면 기본값 files(로컬 사용자 인증)를 씁니다.
TLS 지원(6.1)
ftp는 RFC 4217의 TLS(Transport Layer Security)를 지원합니다. AUTH TLS와 PROT P 명령으로 ftpd와의 통신을 보호하며, 둘 다 TLS를 지원하면 보안 채널이 만들어집니다. Standard 인증 방법만 지원합니다.
-s로 실행하면 홈 디렉터리에서 $HOME/.ftpcnf 파일을 찾아 다음 구성 매개변수로 TLS 세션을 만듭니다. 파일이 없거나 매개변수가 빠졌으면 매개변수 없이 서버에 연결을 시도합니다.
| 매개변수 | 설명 |
|---|---|
CRL_PATH |
인증서 폐기 목록(CRL) 파일 경로(PEM 형식). 주면 서버 인증서를 이 목록으로 검사해 폐기된 인증서면 실패합니다. |
CA_PATH |
인증 기관(CA) 파일 경로(PEM 형식). 주면 서버 인증서가 이 기관이 서명한 것인지 검사해 아니면 실패합니다. |
CIPHER_LIST |
TLS 세션에 쓸 암호 목록. 없으면 기본 목록을 씁니다. |
DEPTH |
CA_PATH를 줬을 때 인증서 계층에서 서버 인증서를 검증할 깊이. 기본 9. |
CERTIFICATE |
TLS 세션에 쓸 올바른 디지털 인증서 체인 파일 경로(PEM 형식). |
CERTIFICATE_PRIVATE_KEY |
인증서 개인 키 경로(PEM 형식). |
TLS를 쓰려면 AIX Web Download Pack Programs 사이트에서 최신 OpenSSL을 설치해야 합니다.
영어 원문
The ftp command uses the File Transfer Protocol (FTP) to transfer files between the local host and a remote host or between two remote hosts. Remote execution of the ftp command is not recommended.
The FTP protocol allows data transfer between hosts that use dissimilar file systems. Although the protocol provides a high degree of flexibility in transferring data, it does not attempt to preserve file attributes (such as the protection mode or modification times of a file) that are specific to a particular file system. Moreover, the FTP protocol makes few assumptions about the overall structure of a file system and does not provide or allow such functions as recursively copying subdirectories.
Note: If you are transferring files between systems and need to preserve file attributes or recursively copy subdirectories, use the rcp command.
Issuing Subcommands
At the ftp> prompt, you can enter subcommands to perform tasks such as listing remote directories, changing the current local and remote directory, transferring multiple files in a single request, creating and removing directories, and escaping to the local shell to perform shell commands. See the Subcommands section for a description of each subcommand.
If you execute the ftp command and do not specify the HostName parameter for a remote host, the ftp command immediately displays the ftp> prompt and waits for an ftp subcommand. To connect to a remote host, execute the open subcommand. When the ftp command connects to the remote host, the ftp command then prompts for the login name and password before displaying the ftp> prompt again. The ftp command is unsuccessful if no password is defined at the remote host for the login name.
The ftp command interpreter, which handles all subcommands entered at the ftp> prompt, provides facilities that are not available with most file-transfer programs, such as:
Handling file-name parameters to ftp subcommands
Collecting a group of subcommands into a single subcommand macro
Loading macros from a
$HOME/.netrcfile
These facilities help simplify repetitive tasks and allow you to use the ftp command in unattended mode.
The command interpreter handles file-name parameters according to the following rules:
If a - (hyphen) is specified for the parameter, standard input (stdin) is used for read operations and standard output (stdout) is used for write operations.
If the preceding check does not apply and file-name expansion is enabled (see the
-gflag or the glob subcommand), the interpreter expands the file name according to the rules of the C shell. When globbing is enabled and a pattern-matching character is used in a subcommand that expects a single file name, results may be different than expected. For example, the append and put subcommands perform file-name expansion and then use only the first file name generated. Other ftp subcommands, such as cd, delete, get, mkdir, rename, and rmdir, do not perform file-name expansion and take the pattern-matching characters literally.For the get, put, mget, and mput subcommands, the interpreter has the ability to translate and map between different local and remote file-name syntax styles (see the case, ntrans, and nmap subcommands) and the ability to modify a local file name if it is not unique (see the runique subcommand). Additionally, the ftp command can send instructions to a remote ftpd server to modify a remote file name if it is not unique (see the sunique subcommand).
Use double quotes (" ") to specify parameters that include blank characters.
Note: The ftp command interpreter does not support pipes. It also does not necessarily support all multibyte-character file names.
To end an ftp session when you are running interactively, use the quit or bye subcommand or the End of File (Ctrl-D) key sequence at the ftp> prompt. To end a file transfer before it has completed, press the Interrupt key sequence. The default Interrupt key sequence is Ctrl-C. The stty command can be used to redefine this key sequence.
The ftp command normally halts transfers being sent (from the local host to the remote host) immediately. The ftp command halts transfers being received (from the remote host to the local host) by sending an FTP ABOR instruction to the remote FTP server and discarding all incoming file transfer packets until the remote server stops sending them. If the remote server does not support the ABOR instruction, the ftp command does not display the ftp> prompt until the remote server has sent all of the requested file. Additionally, if the remote server does something unexpected, you may need to end the local ftp process.
Security and Automatic Login
If Standard is the current authentication method:
The ftp command also handles security by sending passwords to the remote host and permits automatic login, file transfers, and logoff.
If you execute the ftp command and specify the host name (HostName) of a remote host, the ftp command tries to establish a connection to the specified host. If the ftp command connects successfully, the ftp command searches for a local $HOME/.netrc file in your current directory or home directory. If the file exists, the ftp command searches the file for an entry initiating the login process and command macro definitions for the remote host. If the $HOME/.netrc file or automatic login entry does not exist or if your system has been secured with the securetcpip command, the ftp command prompts the user for a user name and password. The command displays the prompt whether or not the HostName parameter is specified on the command line.
Note: The queuing system does not support multibyte host names.
If the ftp command finds a $HOME/.netrc automatic login entry for the specified host, the ftp command attempts to use the information in that entry to log in to the remote host. The ftp command also loads any command macros defined in the entry. In some cases (for example, when the required password is not listed in an automatic login entry), the ftp command prompts for the password before displaying the ftp> prompt.
Once the ftp command completes the automatic login, the ftp command executes the init macro if the macro is defined in the automatic login entry. If the init macro does not exist or does not contain a quit or bye subcommand, the ftp command then displays the ftp> prompt and waits for a subcommand.
Note: The remote user name specified either at the prompt or in a $HOME/.netrc file must exist and have a password defined at the remote host. Otherwise, the ftp command fails.
If Kerberos 5 is the current authentication method
The ftp command will use the extensions to ftp specifications as defined in IETF draft document "draft-ietf-cat-ftpsec-09.txt". The FTP security extensions will be implemented using the Generic Security Service API (GSSAPI) security mechanism. The GSSAPI provides services independent to the underlying security and communication mechanism. The GSSAPI is defined in rfc 1508 and 1509.
The ftp command will use the AUTH and ADAT commands to authenticate with the ftpd daemon. If both support Kerberos authentication, then they will use the local users DCE credentials to authenticate the user on the remote system. If this fails and Standard authentication is configured on both systems, the process described above will be used.
The HostName parameter is the name of the host machine to which files are transferred. The optional Port parameter specifies the ID of the port through which to transmit. (The /etc/services file specifies the default port.)
Note: If the value of the registry is correctly set to the current authentication scheme, the FTP authentication works with the active directory password. If the value of registry is set to null, then the default value of files (local user authentication) is used.
Transport Layer Security support
The ftp command supports Transport Layer Security (TLS) as defined in RFC 4217. TLS is a cryptographic protocol that provides secure communications between clients and servers.
The ftp command uses the AUTH TLS and PROT P commands to secure the communication with the ftpd daemon. If both the AUTH TLS and PROT P commands support the TLS protocol, then a secure channel is established. Only the Standard Authentication method is supported.
If the -s flag is specified when you run the ftp command, then the ftp command searches for a local $HOME/.ftpcnf file in the your home directory. If the file is found, the ftp command uses the following configuration parameters to set up a TLS session with the server. If the file is not found or the configuration parameters are missing, the ftp command attempts to connect to the server without using the configuration parameters.
CRL_PATH The CRL_PATH parameter provides the path to the certificate revocation list file, which must be in privacy enhanced mail (PEM) format. If specified, the digital certificate that is provided by the server is verified against the certificate revocation list. If the certificate was revoked, the TLS session fails. If not specified, the digital certificate is not verified against a certificate revocation list.
CA_PATH The CA_PATH parameter provides the path to the certificate authority file, which must be in PEM format. If specified, the server certificate is verified against the certificate authority. If the digital certificate that is provided by the server was not signed by the security authority, the TLS session fails. If not specified, the digital certificate that is provided by the server is not verified against a certificate revocation list.
CIPHER_LIST If the CIPHER_LIST parameter is specified, the list is used during the TLS session. If not, a default cipher list is used.
DEPHT If the CA_PATH configuration parameter is specified, the DEPTH value is used to verify the certificate that is provided by the ftpd server in the digital certificate hierarchy. If not provided, a default value of 9 is used.
CERTIFICATE The CERTIFICATE parameter provides a path to the chain file of a valid digital certificate in PEM format. This file is used in the TLS session.
CERTIFICATE_PRIVATE_KEY The CERTIFICATE_PRIVATE_KEY parameter contains the path to the certificate private key, in PEM format, which is used during the TLS session. To support TLS, you must install the latest version of the OpenSSL tool from the AIX Web Download Pack Programs website.
플래그
| 플래그 | 설명 |
|---|---|
-C |
send_file로 보내는 파일을 네트워크 버퍼 캐시(NBC)에 캐시합니다. -q와 함께만 쓰며, 보호 없이 바이너리 모드로 보낼 때만 해당합니다. |
-d |
ftp 동작의 디버깅 정보를 syslogd로 보냅니다. /etc/syslog.conf에 user.info 파일이나 user.debug 파일 항목을 더해야 메시지가 남으며(debug 수준은 info 메시지를 포함), 고친 뒤 refresh -s syslogd나 kill -1 syslogd의PID로 알립니다. debug 하위 명령도 봅니다. |
-D DataConnTimeOut |
데이터 연결을 유지하는 최대 시간(초). 기본 300초, 300~3600초. |
-f |
자격 증명을 전달합니다. 인증 방법이 Kerberos 5가 아니면 무시합니다. |
-g |
파일 이름의 메타 문자 확장(globbing)을 끕니다. glob 하위 명령을 봅니다. |
-H |
사용자에게 FILE_Unlink 이벤트가 켜져 있으면 그 감사 로그를 켭니다. 6.1부터 |
-i |
여러 파일을 전송할 때 하나씩 묻지 않습니다. prompt, mget, mput, mdelete 하위 명령을 봅니다. |
-K |
제어·데이터 연결 모두에서 SO_KEEPALIVE 옵션을 끕니다. |
-k realm |
원격의 영역(realm)이 로컬과 다를 때 지정합니다. 여기서 영역은 DCE 셀과 같습니다. Kerberos 5가 아니면 무시합니다. |
-n |
처음 연결할 때 자동 로그인을 막습니다. 없으면 $HOME/.netrc에서 원격 호스트의 로그인·초기화 항목을 찾습니다. user 하위 명령을 봅니다. |
-q |
네트워크로 보낼 때 send_file 서브루틴을 씁니다. 보호 없이 바이너리 모드로 보낼 때만 해당합니다. |
-v |
원격 서버의 응답을 모두 보여 주고 전송 통계를 보여 줍니다. 출력이 터미널이면 기본이며, 표준 입력이 터미널이 아니면 -v나 verbose를 주지 않는 한 꺼집니다. |
-s |
ftpd에 AUTH TLS와 PROT P를 보내 TLS 세션을 시작합니다. TLS 세션이 만들어지고 Standard 인증으로 로그인하면 데이터와 명령이 암호화됩니다. 6.1부터 |
-M |
로컬과 원격 호스트 사이에 파일을 전송한 뒤 ftp가 멈춰 버리지 않게 합니다. 6.1부터 |
영어 원문
-C— Allows the user to specify that the outgoing file sent using thesend_filecommand must be cached in the Network Buffer Cache (NBC). This flag cannot be used unless the-qflag is specified. This flag is only applicable when a file is being sent out in the binary mode with no protection.-d— Sends debugging information about ftp command operations to the syslogd daemon. If you specify the-dflag, you must edit the /etc/syslog.conf file and add one of the following entries:user.info FileNameORuser.debug FileNameNote: The syslogd daemon debug level includes info level messages. If you do not edit the /etc/syslog.conf file, no messages are produced. After changing the /etc/syslog.conf file, run the refresh-s syslogdor kill -1 SyslogdPID command to inform the syslogd daemon of the changes to its configuration file. For more information about debug levels, refer to the /etc/syslog.conf file. Also, refer to the debug subcommand.-DDataConnTimeOut — Specifies the maximum number of seconds that the ftp command holds a data connection. The default value is 300 seconds and can range from 300 seconds to 3600 seconds.-f— Causes the credentials to be forwarded. This flag will be ignored if Kerberos 5 is not the current authentication method.-g— Disables the expansion of metacharacters in file names. Interpreting metacharacters can be referred to as expanding (sometimes called globbing) a file name. See the glob subcommand.-H— Turns on audit logging for theFILE_Unlinkevent if the event is enabled for the user.-i— Turns off interactive prompting during multiple file transfers. See the prompt, mget, mput, and mdelete subcommands for descriptions of prompting during multiple file transfers.-K— Disables theSO_KEEPALIVEoption defined in the sys/socket.h file on both the control and data connection.-krealm — Allows the user to specify the realm of the remote station if it is different from the local systems realm. For these purposes, a realm is synonymous with a DCE cell. This flag will be ignored if Kerberos 5 is not the current authentication method.-n— Prevents an automatic login on the initial connection. Otherwise, the ftp command searches for a$HOME/.netrcentry that describes the login and initialization process for the remote host. See the user subcommand.-q— Allows the user to specify that thesend_filesubroutine must be used for sending the file on the network. This flag is only applicable when a file is being sent out in the binary mode with no protection.-v— Displays all the responses from the remote server and provides data transfer statistics. This display mode is the default when the output of the ftp command is to a terminal, such as the console or a display. If stdin is not a terminal, the ftp command disables verbose mode unless the user invoked the ftp command with the-vflag or issued the verbose subcommand.-s— Starts a TLS session with the server by sending an AUTH TLS command and a PROT P command to the ftpd daemon. If the TLS session is established, and you are authenticated by using the Standard Authentication method, the transfer of the data and commands is encrypted.-M— Prevents the ftp command from being blocked after a file is transferred between a local and a remote host.
하위 명령
ftp> 프롬프트에서 입력하는 하위 명령입니다. 공백이 있는 매개변수는 큰따옴표로 감쌉니다.
연결과 세션
| 하위 명령 | 설명 |
|---|---|
open HostName [Port] |
그 호스트의 FTP 서버에 연결합니다. 자동 로그인이 켜져 있으면(-n을 주지 않았으면) 로그인을 시도하며, 올바른 내용과 권한의 .netrc가 홈 디렉터리에 있어야 합니다. |
user User [Password] [Account] |
원격 FTP 서버에 사용자를 알립니다. 필요한데 비밀번호나 계정을 주지 않으면 묻습니다. -n이 없으면 처음 연결 때 자동으로 보내며, 자동 로그인에는 .netrc가 필요합니다. |
account [Password] |
원격 호스트가 자원 접근 전에 요구하는 보조 비밀번호를 보냅니다. 주지 않으면 화면에 보이지 않게 묻습니다. |
close, disconnect |
전송 세션을 끝내지만 ftp는 끝내지 않습니다. 정의한 매크로는 지워집니다. |
bye, quit |
연결을 닫고 ftp를 끝냅니다. |
reinitialize |
모든 I/O를 비우고 전송을 마친 뒤, 원격 호스트에 로그인하지 않고 막 시작한 것처럼 기본값을 모두 되돌립니다. |
proxy [Subcommand] |
보조 제어 연결에서 하위 명령을 실행해 원격 FTP 서버 두 대 사이에 파일을 옮깁니다. 첫 proxy는 open이어야 하며, proxy ?로 쓸 수 있는 하위 명령을 봅니다. proxy를 붙이면 open은 새 매크로를 정의하지 않고 close는 매크로를 지우지 않으며, get·mget은 주 연결의 호스트에서 보조 연결의 호스트로, put·mput·append는 반대로 옮깁니다. |
passive |
수동 모드를 켜고 끕니다. 끄면 서버가 클라이언트로 데이터 연결을 열고, 켜면 클라이언트가 서버로 엽니다. 방화벽·NAT 뒤에서는 보통 켭니다. proxy 전송에서는 보조 연결의 서버가 PASV를 지원해야 합니다. |
sendport |
데이터 전송마다 FTP PORT 명령을 쓸지 켜고 끕니다(기본 켬). PORT를 받은 척하고 무시하는 서버를 상대할 때 끕니다. |
status |
ftp와 하위 명령의 현재 상태를 보여 줍니다. |
system |
원격 머신의 운영 체제 종류를 보여 줍니다. |
remotehelp [Subcommand] |
원격 FTP 서버에 도움말을 요청합니다. |
quote String |
문자열을 그대로 원격 호스트에 보냅니다. 쓸 수 있는 값은 remotehelp나 quote help로 봅니다. 데이터 전송이 따르는 명령을 quote로 보내면 결과를 예측할 수 없습니다. |
site Args |
유휴 타임아웃 보기·설정, 파일 생성 umask 보기·설정, chmod로 파일 권한 바꾸기. Args는 umask나 chmod. |
reset |
응답 큐를 비워 명령 해석을 다시 맞춥니다. |
! [Command [Parameters]] |
로컬 호스트에서 대화형 셸을 실행합니다. 명령과 매개변수를 함께 줄 수 있습니다. |
?, help [Subcommand] |
하위 명령 도움말. 없으면 알려진 하위 명령 목록을 보여 줍니다. |
디렉터리와 파일 조작
| 하위 명령 | 설명 |
|---|---|
cd RemoteDirectory, cdup |
원격 작업 디렉터리를 바꾸거나 부모 디렉터리로 옮깁니다. |
lcd [Directory] |
로컬 작업 디렉터리를 바꿉니다. 없으면 홈 디렉터리로 갑니다. |
pwd |
원격의 현재 디렉터리를 보여 줍니다. |
ls [RemoteDirectory] [LocalFile] |
원격 디렉터리의 짧은 목록을 로컬 파일에 씁니다. 디렉터리가 없으면 현재 원격 디렉터리, 파일이 없거나 -면 터미널에 보여 줍니다. |
dir [RemoteDirectory] [LocalFile], nlist ... |
원격 디렉터리 내용 목록. 매개변수 규칙은 ls와 같습니다. |
mls, mdir [RemoteDirectories LocalFile] |
원격에서 여러 디렉터리를 확장해 짧은(mls)·자세한(mdir) 목록을 로컬 파일에 씁니다. 패턴 문자가 있는데 파일이 없으면 묻고, 공백으로 나눈 목록이면 마지막 인수는 로컬 파일이나 -여야 합니다. 대화형 확인이 켜져 있으면 마지막 인수가 로컬 파일인지 확인합니다. |
mkdir [RemoteDirectory], rmdir RemoteDirectory |
원격 디렉터리를 만들거나 지웁니다. |
delete RemoteFile, mdelete RemoteFiles |
원격 파일을 지웁니다. mdelete는 원격에서 확장한 파일들을 지웁니다. |
rename FromName ToName |
원격 파일 이름을 바꿉니다. |
size RemoteFile |
원격 파일 크기(바이트). |
modtime [FileName] |
원격 파일의 마지막 수정 시각. 연결되어 있지 않으면 오류로 끝나고, 첫 매개변수만 씁니다. 이름이 없으면 묻습니다. |
파일 전송
| 하위 명령 | 설명 |
|---|---|
get RemoteFile [LocalFile], recv ... |
원격 파일을 로컬로 복사합니다. 로컬 이름이 없으면 원격 이름을 case, ntrans, nmap 설정으로 바꿔 씁니다. 현재 type, form, mode, struct 설정으로 전송합니다. |
mget RemoteFiles |
원격에서 확장한 파일들을 로컬 현재 디렉터리로 복사합니다. |
put LocalFile [RemoteFile], send ... |
로컬 파일을 원격 호스트에 저장합니다. 원격 이름이 없으면 로컬 이름을 ntrans, nmap 설정으로 바꿔 씁니다. |
mput [LocalFiles] |
로컬에서 확장한 파일들을 원격 호스트로 복사합니다. |
append LocalFile [RemoteFile] |
로컬 파일을 원격 파일 뒤에 붙입니다. |
restart get | put | append |
마지막 체크포인트부터 전송을 다시 시작합니다. 중단된 하위 명령과 구조·유형·형식이 같아야 합니다. |
runique |
받는 파일 이름이 로컬에 이미 있으면 .1, .2 … .99를 붙여 겹치지 않게 합니다(기본 끔, 끄면 덮어씀). .99까지 못 찾으면 오류를 내고 그 전송을 건너뜁니다. |
sunique |
보내는 파일 이름이 원격에 이미 있으면 원격 서버가 이름을 바꾸게 합니다(기본 끔). 서버가 STOU를 지원해야 합니다. |
copylocal |
같은 호스트·같은 경로로 전송해 파일이 0바이트가 되는 것을 막는 검사를 건너뜁니다(기본 끔). |
전송 형식
| 하위 명령 | 설명 |
|---|---|
type [ascii | binary | ebcdic | image | local M | tenex] |
전송 유형. 인수가 없으면 현재 유형을 보여 줍니다. 기본 ascii(네트워크 ASCII), binary·image(바이너리 이미지, 더 효율적), ebcdic, local M(머신 워드당 비트 수 M의 로컬 유형, 기본값 없음), tenex(TENEX 머신용). |
ascii, binary, image, ebcdic, tenex, local M |
해당 type 하위 명령과 같습니다. |
form [carriage-control | non-print | telnet] |
전송 형식(form). carriage-control, non-print, telnet도 해당 form과 같습니다. |
mode [stream | block] |
전송 모드. 기본 stream. stream, block도 해당 mode와 같습니다. |
struct [file | record] |
전송 구조. file, record도 해당 struct와 같습니다. |
cr |
ASCII 전송에서 받은 레코드의 CR LF 가운데 CR을 뺄지 켜고 끕니다. 다른 운영 체제의 레코드 안에 LF만 있는 경우를 구분하려면 끕니다. |
case |
켜면 대문자로만 된 원격 파일 이름을 로컬에 소문자로 씁니다(기본 끔). |
ntrans [InCharacters [OutCharacters]] |
파일 이름의 글자 바꾸기를 켜고 끕니다. 매개변수가 없으면 끕니다. 원본 이름에서 InCharacters의 글자를 OutCharacters의 같은 자리 글자로 바꾸며, 짝이 없는 글자는 지웁니다. |
nmap [InPattern OutPattern] |
파일 이름 대응을 켜고 끕니다. $1~$9로 InPattern의 부분을 받아 OutPattern에서 씁니다. 로컬과 원격의 이름 규칙이 다를 때 씁니다. |
exp_cmd |
일반 프로토콜 명령과 실험용 명령 사이를 바꿉니다(기본 끔). |
표시와 기타
| 하위 명령 | 설명 |
|---|---|
prompt |
여러 파일 전송·삭제 때 하나씩 확인할지 켜고 끕니다(기본 켬). |
glob |
mdelete, mget, mput의 파일 이름 확장을 켜고 끕니다. mput의 확장은 로컬에서 csh처럼, mdelete·mget은 원격에서 파일 이름마다 따로 합니다. 디렉터리 이름의 확장은 서버마다 다를 수 있어 mls로 미리 봅니다. 디렉터리 트리 전체는 mget·mput 대신 tar 묶음을 바이너리로 옮깁니다. |
hash |
데이터 블록(1024바이트)마다 #을 출력할지 켜고 끕니다. |
bell |
파일 전송이 끝날 때마다 벨을 울립니다. |
verbose |
원격 서버의 응답과 전송 통계를 보여 줄지 켜고 끕니다(기본 켬). |
trace |
패킷 추적을 켜고 끕니다. |
debug [0 | 1] |
디버그 기록을 켜고 끕니다. 켜면 원격으로 보내는 명령을 출력하고 재시작 제어 파일을 저장합니다(Ctrl+C도 저장). 디버깅 정보는 syslogd로 가므로 -d처럼 /etc/syslog.conf를 고쳐야 합니다. |
macdef Macro |
매크로를 정의합니다. 빈 줄까지의 다음 줄들이 매크로 내용입니다. 모두 합쳐 4096자 이내로 16개까지 정의하며, 다시 정의하거나 close할 때까지 남습니다. 매크로 안에서 $숫자는 호출할 때의 매개변수로, $i는 매개변수마다 반복하라는 뜻이며, \는 특수 문자를 이스케이프합니다. |
$Macro [Parameters] |
macdef로 정의한 매크로를 실행합니다. 매개변수는 확장하지 않습니다. |
private, safe, protect |
인증 방법이 정해져 있을 때 보호 수준을 private(무결성과 기밀성)나 safe(무결성)로 정하고, protect는 현재 보호 수준을 돌려줍니다. |
영어 원문
The following ftp subcommands can be entered at the ftp> prompt. Use double quotes (" ") to specify parameters that include blank characters.
- ![Command [Parameters]] — Invokes an interactive shell on the local host. An optional command, with one or more optional parameters, can be given with the shell command.
$Macro[Parameters] — Executes the specified macro, previously defined with the macdef subcommand. Parameters are not expanded.- ?[Subcommand] — Displays a help message describing the subcommand. If you do not specify a Subcommand parameter, the ftp command displays a list of known subcommands.
- account [Password] — Sends a supplemental password that a remote host may require before granting access to its resources. If the password is not supplied with the command, the user is prompted for the password. The password is not displayed on the screen.
- append LocalFile [RemoteFile] — Appends a local file to a file on the remote host. If the remote file name is not specified, the local file name is used, altered by any setting made with the ntrans subcommand or the nmap subcommand. The append subcommand uses the current values for form, mode, struct, and type subcommands while appending the file.
- ascii — Synonym for the type ascii subcommand.
- bell — Sounds a bell after the completion of each file transfer.
- binary — Synonym for the type binary subcommand.
- block — Synonym for the mode block subcommand.
- bye — Ends the file-transfer session and exits the ftp command. Same as the quit subcommand.
- carriage-control — Synonym for the form carriage-control subcommand.
- case — Sets a toggle for the case of file names. When the case subcommand is On, the ftp command changes remote file names displayed in all capital letters from uppercase to lowercase when writing them in the local directory. The default is Off (so the ftp command writes uppercase remote file names in uppercase in the local directory).
- cd RemoteDirectory — Changes the working directory on the remote host to the specified directory.
- cdup — Changes the working directory on the remote host to the parent of the current directory.
- close — Ends the file-transfer session, but does not exit the ftp command. Defined macros are erased. Same as the disconnect subcommand.
- copylocal — Toggles local copy. copylocal defaults to off. An effort is made by ftp to make sure you do not zero out a file by ftp'ing it to itself (eg. same hostname, same pathname). Turning copylocal ON bypasses this check.
- cr — Strips the carriage return character from a carriage return and line-feed sequence when receiving records during ASCII-type file transfers. (The ftp command terminates each ASCII-type record with a carriage return and line feed during file transfers.) Records on remote hosts with operating systems other than the one you are running can have single line feeds embedded in records. To distinguish these embedded line feeds from record delimiters, set the cr subcommand to Off. The cr subcommand toggles between On and Off.
- debug [0
|1] — Toggles debug record keeping On and Off. Specify debug or debug 1 to print each command sent to the remote host and save the restart control file. Specify debug again, or debug 0, to stop the debug record keeping. The Ctrl-C key sequence also saves the restart control file. Specifying the debug subcommand sends debugging information about ftp command operations to the syslogd daemon. If you specify the debug subcommand, you must edit the /etc/syslog.conf file and add one of the following entries:user.info FileNameORuser.debug FileNameNote: The syslogd daemon debug level includes info level messages. If you do not edit the /etc/syslog.conf file, no messages are produced. After changing the /etc/syslog.conf file, run the refresh-s syslogdor kill -1 SyslogdPID command to inform the syslogd daemon of the changes to its configuration file. For more information about debug levels, refer to the /etc/syslog.conf file. Also, refer to the ftp -d flag. - delete RemoteFile — Deletes the specified remote file.
- dir [RemoteDirectory][LocalFile] — Writes a listing of the contents of the specified remote directory (RemoteDirectory) to the specified local file (LocalFile). If the RemoteDirectory parameter is not specified, the dir subcommand lists the contents of the current remote directory. If the LocalFile parameter is not specified or is a - (hyphen), the dir subcommand displays the listing on the local terminal.
- disconnect — Ends the file-transfer session but does not exit the ftp command. Defined macros are erased. Same as the close subcommand.
- ebcdic — Synonym for the type ebcdic subcommand.
exp_cmd— Toggles between conventional and experimental protocol commands. The default is off.- file — Synonym for the struct file subcommand.
- form [ carriage-control
|non-print|telnet ] — Specifies the form of the file transfer. The form subcommand modifies the type subcommand to send the file transfer in the indicated form. Valid arguments are carriage-control, non-print, and telnet. carriage-control Sets the form of the file transfer to carriage-control. non-print Sets the form of the file transfer to non-print. telnet Sets the form of the file transfer to Telnet. Telnet is a Transmission Control Protocol/Internet Protocol (TCP/IP) protocol that opens connections to a system. - get RemoteFile [LocalFile] — Copies the remote file to the local host. If the LocalFile parameter is not specified, the remote file name is used locally and is altered by any settings made by the case, ntrans, and nmap subcommands. The ftp command uses the current settings for the type, form, mode, and struct subcommands while transferring the file.
- glob — Toggles file-name expansion (globbing) for the mdelete, mget, and mput subcommands. If globbing is disabled, file-name parameters for these subcommands are not expanded. When globbing is enabled and a pattern-matching character is used in a subcommand that expects a single file name, results may be different than expected. For example, the append and put subcommands perform file-name expansion and then use only the first file name generated. Other ftp subcommands, such as cd, delete, get, mkdir, rename, and rmdir, do not perform file-name expansion and take the pattern-matching characters literally. Globbing for the mput subcommand is done locally in the same way as for the csh command. For the mdelete and mget subcommands, each file name is expanded separately at the remote machine and the lists are not merged. The expansion of a directory name can be different from the expansion of a file name, depending on the remote host and the ftp server. To preview the expansion of a directory name, use the mls subcommand:
mls RemoteFileTo transfer an entire directory subtree of files, transfer a tar archive of the subtree in binary form, rather than using the mget or mput subcommand. - hash — Toggles hash sign (#) printing. When the hash subcommand is on, the ftp command displays one hash sign for each data block (1024 bytes) transferred.
- help [Subcommand] — Displays help information. See the ? subcommand.
- image — Synonym for the type image subcommand.
- lcd [Directory] — Changes the working directory on the local host. If you do not specify a directory, the ftp command uses your home directory.
- local M — Synonym for the type local M subcommand.
- ls [RemoteDirectory] [LocalFile] — Writes an abbreviated file listing of a remote directory to a local file. If the RemoteDirectory parameter is not specified, the ftp command lists the current remote directory. If the LocalFile parameter is not specified or is a - (hyphen), the ftp command displays the listing on the local terminal.
- macdef Macro — Defines a subcommand macro. Subsequent lines up to a null line (two consecutive line feeds) are saved as the text of the macro. Up to 16 macros, containing at most 4096 characters for all macros, can be defined. Macros remain defined until either redefined or a close subcommand is executed. The
$(dollar sign) and\(backslash) are special characters in ftp macros. A$symbol followed by one or more numbers is replaced by the corresponding macro parameter on the invocation line (see the$subcommand). A$symbol followed by the letter i indicates that the macro is to loop, with the$icharacter combination being replaced by consecutive parameters on each pass. The first macro parameter is used on the first pass, the second parameter is used on the second pass, and so on. A\symbol prevents special treatment of the next character. Use the\symbol to turn off the special meanings of the$and\. (backslash period) symbols. - mdelete RemoteFiles — Expands the files specified by the RemoteFiles parameter at the remote host and deletes the remote files.
- mdir [RemoteDirectories LocalFile] — Expands the directories specified by the RemoteDirectories parameter at the remote host and writes a listing of the contents of those directories to the file specified in the LocalFile parameter. If the RemoteDirectories parameter contains a pattern-matching character, the mdir subcommand prompts for a local file if none is specified. If the RemoteDirectories parameter is a list of remote directories separated by blanks, the last argument in the list must be either a local file name or a - (hyphen). If the LocalFile parameter is - (hyphen), the mdir subcommand displays the listing on the local terminal. If interactive prompting is on (see the prompt subcommand), the ftp command prompts the user to verify that the last parameter is a local file and not a remote directory.
- mget RemoteFiles — Expands the RemoteFiles parameter at the remote host and copies the indicated remote files to the current directory on the local host. See the glob subcommand for more information on file-name expansion. The remote file names are used locally and are altered by any settings made by the case, ntrans, and nmap subcommands. The ftp command uses the current settings for the form, mode, struct, and type subcommands while transferring the files.
- mkdir [RemoteDirectory] — Creates the directory specified in the RemoteDirectory parameter on the remote host.
- mls [RemoteDirectories LocalFile] — Expands the directories specified in the RemoteDirectories parameter at the remote host and writes an abbreviated file listing of the indicated remote directories to a local file. If the RemoteDirectories parameter contains a pattern-matching character, the mls subcommand prompts for a local file if none is specified. If the RemoteDirectories parameter is a list of remote directories separated by blanks, the last argument in the list must be either a local file name or a - (hyphen). If the LocalFile parameter is - (hyphen), the mls subcommand displays the listing on the local terminal. If interactive prompting is on (see the prompt subcommand), the ftp command prompts the user to verify that the last parameter is a local file and not a remote directory.
- mode [ stream
|block ] — Sets file-transfer mode. If an argument is not supplied, the default is stream. block Sets the file-transfer mode to block. stream Sets the file-transfer mode to stream. - modtime — Shows the last modification time of the specified file on the remote machine. If the ftp command is not connected to a host prior to execution, the modtime subcommand terminates with an error message. The ftp command ignores parameter beyond the first parameter. If the FileName parameter is not specified, the ftp command prompts for a file name. If no file name is given, the ftp command sends a usage message to standard output and terminates the subcommand. If the name specified by the FileName parameter exists on the remote host, and the name specifies a file, then the ftp command sends a message containing the last modification time of the file to standard output and terminates the subcommand. If FileName specifies a directory, the ftp command sends an error message to standard output and terminates the subcommand. Note: The modtime subcommand interprets metacharacters when allowed.
- mput [LocalFiles] — Expands the files specified in the LocalFiles parameter at the local host and copies the indicated local files to the remote host. See the glob subcommand for more information on file-name expansion. The local file names are used at the remote host and are altered by any settings made by the ntrans and nmap subcommands. The ftp command uses the current settings for the type, form, mode, and struct subcommands while transferring the files.
- nlist [RemoteDirectory][LocalFile] — Writes a listing of the contents of the specified remote directory (RemoteDirectory) to the specified local file (LocalFile). If the RemoteDirectory parameter is not specified, the nlist subcommand lists the contents of the current remote directory. If the LocalFile parameter is not specified or is a - (hyphen), the nlist subcommand displays the listing on the local terminal.
- nmap [InPattern OutPattern] — Turns the file-name mapping mechanism On or Off. If no parameters are specified, file-name mapping is turned off. If parameters are specified, source file names are mapped for the mget and mput subcommands and for the get and put subcommands when the destination file name is not specified. This subcommand is useful when the local and remote hosts use different file-naming conventions or practices. Mapping follows the pattern set by the InPattern and OutPattern parameters. The InPattern parameter specifies the template for incoming file names, which may have already been processed according to the case and ntrans settings. The template variables
$1through$9can be included in the InPattern parameter. All characters in the InPattern parameter, other than the$(dollar sign) and the\$(backslash, dollar sign), are treated literally and are used as delimiters between InPattern variables. For example, if the InPattern parameter is$1.$2and the remote file name ismydata.dat, the value of$1ismydataand the value of$2isdat. The OutPattern parameter determines the resulting file name. The variables$1through$9are replaced by their values as derived from the InPattern parameter, and the variable$0is replaced by the original file name. Additionally, the sequence [Sequence1,Sequence2] is replaced by the value of Sequence1, if Sequence1 is not null; otherwise, it is replaced by the value of Sequence2. For example, the subcommand:nmap $1.$2.$3 [$1,$2].[$2,file]would yieldmyfile.datafrommyfile.dataormyfile.data.old,myfile.filefrommyfile, andmyfile.myfilefrom.myfile. Use the\(backslash) symbol to prevent the special meanings of the$(dollar sign), [ (left bracket), ] (right bracket), and , (comma) in the OutPattern parameter. - non-print — Synonym for the form non-print subcommand.
- ntrans [InCharacters
[OutCharacters]] Turns the file-name character translation mechanism On and Off. If no parameters are specified, character translation is turned off. If parameters are specified, characters in source file names are translated for mget and mput subcommands and for get and put subcommands when the destination file name is not specified.
This subcommand is useful when the local and remote hosts use different file-naming conventions or practices. Character translation follows the pattern set by the InCharacters and OutCharacters parameter. Characters in a source file name matching characters in the InCharacters parameter are replaced by the corresponding characters in the OutCharacters parameter.
If the string specified by the InCharacters parameter is longer than the string specified by the OutCharacters parameter, the characters in the InCharacters parameter are deleted if they have no corresponding character in the OutCharacters parameter.
- open HostName [Port] — Establishes a connection to the FTP server at the host specified by the HostName parameter. If the optional port number is specified, the ftp command attempts to connect to a server at that port. If the automatic login feature is set (that is, the
-nflag was not specified on the command line), the ftp command attempts to log in the user to the FTP server. You must also have a$HOME/.netrcfile with the correct information in it and the correct permissions set. The .netrc file must be in your home directory. - passive — Toggles passive mode for file transfers. When a file transfer command (such as get, mget, put, or mput) is invoked with passive mode off, the ftp server opens a data connection back to the client. In passive mode, the client opens data connections to the server when sending or receiving data.
- private — Sets the protection level to private only when the authentication method is set. At this level, data integrity and confidentiality are protected.
- prompt — Toggles interactive prompting. If interactive prompting is on (the default), the ftp command prompts for verification before retrieving, sending, or deleting multiple files during the mget, mput, and mdelete subcommands. Otherwise, the ftp command acts accordingly on all files specified.
- protect — This command returns the current level of protection.
- proxy [Subcommand] — Executes an ftp command on a secondary control connection. This subcommand allows the ftp command to connect simultaneously to two remote FTP servers for transferring files between the two servers. The first proxy subcommand should be an open subcommand to establish the secondary control connection. Enter the proxy ? subcommand to see the other ftp subcommands that are executable on the secondary connection. The following subcommands behave differently when prefaced by the proxy subcommand: • The open subcommand does not define new macros during the automatic login process. • The close subcommand does not erase existing macro definitions. • The get and mget subcommands transfer files from the host on the primary connection to the host on the secondary connection. • The put, mput, and append subcommands transfer files from the host on the secondary connection to the host on the primary connection. • The restart subcommand can be handled by the proxy command. • The status subcommand displays accurate information. File transfers require that the FTP server on the secondary connection must support the PASV (passive) instruction.
- put LocalFile [RemoteFile] — Stores a local file on the remote host. If you do not specify the RemoteFile parameter, the ftp command uses the local file name to name the remote file, and the remote file name is altered by any settings made by the ntrans and nmap subcommands. The ftp command uses the current settings for the type, form, mode, and struct subcommands while transferring the files.
- pwd — Displays the name of the current directory on the remote host.
- quit — Closes the connection and exits the ftp command. Same as the bye subcommand.
- quote String — Sends the string specified by the String parameter verbatim to the remote host. Execute the remotehelp or quote help subcommand to display a list of valid values for the String parameter. Note: "Quoting" commands that involve data transfers can produce unpredictable results.
- record — Synonym for the struct record subcommand.
- recv RemoteFile [LocalFile] — Copies the remote file to the local host. Same as the get subcommand.
- reinitialize — Reinitializes an FTP session by flushing all I/O and allowing transfers to complete. Resets all defaults as if a user had just started an FTP session without logging in to a remote host.
- remotehelp [Subcommand] — Requests help from the remote FTP server.
- rename FromName ToName — Renames a file on the remote host.
- reset — Clears the reply queue. This subcommand resynchronizes the command parsing.
- restart get
|put|append — Restarts a file transfer at the point where the last checkpoint was made. To run successfully, the subcommand must be the same as the aborted subcommand, including structure, type, and form. Valid arguments are get, put, and append. - rmdir RemoteDirectory — Removes the remote directory specified by the RemoteDirectory parameter at the remote host.
- runique — (ReceiveUnique) Toggles the facility for creating unique file names for local destination files during get and mget subcommands. If this facility is Off (the default), the ftp command overwrites local files. Otherwise, if a local file has the same name as that specified for a local destination file, the ftp command modifies the specified name of the local destination file with
.1. If a local file is already using the new name, the ftp command appends the postfix .2 to the specified name. If a local file is already using this second name, the ftp command continues incrementing the postfix until it either finds a unique file name or reaches .99 without finding a unique file name. If the ftp command cannot find a unique file name, the ftp command reports an error and the transfer does not take place. Note that the runique subcommand does not affect local file names generated from a shell command. - safe — Sets the protection level to "safe." At this level, data is integrity protected.
- send LocalFile [RemoteFile] — Stores a local file on the remote host. Same as the put subcommand.
- sendport — Toggles the use of FTP PORT instructions. By default, the ftp command uses a PORT instruction when establishing a connection for each data transfer. When the use of PORT instructions is disabled, the ftp command does not use PORT instructions for data transfers. The PORT instruction is useful when dealing with FTP servers that ignore PORT instructions while incorrectly indicating the instructions have been accepted.
- site Args — Displays or sets the idle time-out period, displays or sets the file-creation umask, or changes the permissions of a file, using the chmod command. Possible values for the Args parameter are umask and chmod.
- size RemoteFile — Displays the size in bytes of the remote file specified by the RemoteFile parameter.
- status — Displays the current status of the ftp command as well as the status of the subcommands.
- stream — Synonym for the mode stream subcommand.
- struct [ file
|record ] — Sets the data transfer structure type. Valid arguments are file and record. file Sets the data-transfer structure type to file. record Sets the data-transfer structure type to record. - sunique — (Send/Store Unique) Toggles the facility for creating unique file names for remote destination files during put and mput subcommands. If this facility is off (the default), the ftp command overwrites remote files. Otherwise, if a remote file has the same name as that specified for a remote destination file, the remote FTP server modifies the name of the remote destination file. Note that the remote server must support the STOU instruction.
- system — Shows the type of operating system running on the remote machine.
- telnet — Synonym for the form telnet subcommand.
- tenex — Synonym for the type tenex subcommand.
- trace — Toggles packet tracing.
- type [ ascii
|binary|ebcdic|image|local M|tenex ] — Sets the file-transfer type. Valid arguments are ascii, binary, ebcdic, image, local M, and tenex. If an argument is not specified, the current type is printed. The default type is ascii; the binary type can be more efficient than ascii. ascii Sets the file-transfer type to network ASCII. This type is the default. File transfer may be more efficient with binary-image transfer. See the binary argument for further information. binary Sets the file-transfer type to binary image. This type can be more efficient than an ASCII transfer. ebcdic Sets the file-transfer type to EBCDIC. image Sets the file-transfer type to binary image. This type can be more efficient than an ASCII transfer. local M Sets the file-transfer type to local. The M parameter defines the decimal number of bits per machine word. This parameter does not have a default. tenex Sets the file-transfer type to that needed for TENEX machines. - user User [Password] [Account] — Identifies the local user (User) to the remote FTP server. If the Password or Account parameter is not specified and the remote server requires it, the ftp command prompts for the password or account locally. If the Account parameter is required, the ftp command sends it to the remote server after the remote login process completes. Note: Unless automatic login is disabled by specifying the
-nflag on the command line, the ftp command sends the User, Password, and Account parameters automatically for the initial connection to the remote server. You also need a .netrc file in your home directory in order to issue an automatic login. - verbose — Toggles verbose mode. When the verbose mode is on (the default), the ftp command displays all responses from the remote FTP server. Additionally, the ftp command displays statistics on all file transfers when the transfers complete.
예제
canopus에 로그인해 로컬 도움말(help)과 원격 도움말(remotehelp), 상태(status)를 보고,bell,prompt,runique,trace,verbose를 켜고 끈 뒤 끝냅니다. 전체 출력은 영어 원문에 있습니다.
$ ftp canopus
Connected to canopus.austin.century.com.
220 canopus.austin.century.com FTP server (Version 4.1 Sat Nov 23 12:52:09 CST 1991) ready.
Name (canopus:eric): dee
331 Password required for dee.
Password:
230 User dee logged in.
ftp> status
Connected to canopus.austin.century.com.
No proxy connection.
Mode: stream; Type: ascii; Form: non-print; Structure: file
Verbose: on; Bell: off; Prompting: on; Globbing: on
Store unique: off; Receive unique: off
Case: off; CR stripping: on
Ntrans: off
Nmap: off
Hash mark printing: off; Use of PORT cmds: on
ftp> bell
Bell mode on.
ftp> prompt
Interactive mode off.
ftp> quit
canopus에 로그인해 작업 디렉터리를 보고(pwd) 바꾼 뒤(cd desktop), 전송 유형을 ASCII로 하고(type ascii) 로컬 파일을 보내고(send typescript), 부모 디렉터리로 옮겨(cdup) 끝냅니다..netrc로 자동 로그인해canopus에 연결한 뒤 부모 디렉터리로 옮기고(cdup), 작업 디렉터리를 보고(pwd), 목록을 보고(dir), 파일을 지우고(delete), 목록을 로컬 파일에 쓰고(dir . 파일), 세션을 닫고(close) 끝냅니다.(6.1) 파일 전송 뒤 멈추는 문제(예: AIX FTP 클라이언트에서 Windows FTP 서버로)를 피해
ftp>프롬프트로 돌아오게 합니다.
ftp -M hostname
자주 쓰는 형태:
$ ftp 10.1.1.20
ftp> binary # 바이너리 전송(필수)
ftp> prompt # mget·mput 확인 끄기
ftp> hash # 진행 표시
ftp> lcd /tmp
ftp> cd /backup
ftp> mget *.tar
ftp> bye
.netrc로 무인 전송(권한은 chmod 600 ~/.netrc):
machine 10.1.1.20 login backup password 비밀번호
macdef init
binary
prompt
cd /backup
mput /data/*.tar
bye
영어 원문
- To invoke the ftp command, log in to the system
canopus, display local help information, display remote help information, display status, toggle the bell, prompt, runique, trace, and verbose subcommands, and then quit, enter:
$ ftp canopus
Connected to canopus.austin.century.com.
220 canopus.austin.century.com FTP server (Version 4.1 Sat Nov 23 12:52:09 CST 1991) ready.
Name (canopus:eric): dee
331 Password required for dee.
Password:
230 User dee logged in.
ftp> help
Commands may be abbreviated. Commands are:
! delete mdelete proxy runique
$ debug mdir sendport send
account dir mget put size
append disconnect mkdir pwd status
ascii form mls quit struct
bell get mode quote sunique
binary glob modtime recv system
bye hash mput remotehelp tenex
case help nmap rstatus trace
cd image nlist rhelp type
cdup lcd ntrans rename user
close ls open reset verbose
cr macdef prompt rmdir ?
clear private protect safe
ftp> remotehelp
214-The following commands are recognized(* =>’s unimplemented).
USER PORT RETR MSND* ALLO DELE SITE* XMKD CDUP
PASS PASV STOR MSOM* REST* CWD STAT* RMD XCUP
ACCT* TYPE APPE MSAM* RNFR XCWD HELP XRMD STOU
REIN* STRU MLFL* MRSQ* RNTO LIST NOOP PWD
QUIT MODE MAIL* MRCP* ABOR NLST MKD XPWD
AUTH ADAT PROT PBSZ MIC ENC CCC
214 Direct comments to [email protected].
ftp> status
Connected to canopus.austin.century.com.
No proxy connection.
Mode: stream; Type: ascii; Form: non-print; Structure: file
Verbose: on; Bell: off; Prompting: on; Globbing: on
Store unique: off; Receive unique: off
Case: off; CR stripping: on
Ntrans: off
Nmap: off
Hash mark printing: off; Use of PORT cmds: on
ftp> bell
Bell mode on.
ftp> prompt
Interactive mode off.
ftp> runique
Receive unique on.
ftp> trace
Packet tracing on.
ftp> verbose
Verbose mode off.
ftp> quit
$
To invoke the ftp command, log in to the system
canopus, print the working directory, change the working directory, set the file transfer type to ASCII, send a local file to the remote host, change the working directory to the parent directory, and then quit, enter:$ ftp canopus Connected to canopus.austin.century.com. 220 canopus.austin.century.com FTP server (Version 4.1 Sat Nov 23 12:52:09 CST 1991) ready. Name (canopus:eric): dee 331 Password required for dee. Password: 230 User dee logged in. ftp> pwd 257 "/home/dee" is current directory. ftp> cd desktop 250 CWD command successful. ftp> type ascii 200 Type set to A. ftp> send typescript 200 PORT command successful. 150 Opening data connection for typescript (128.114.4.99,1412). 226 Transfer complete. ftp> cdup 250 CWD command successful. ftp> bye 221 Goodbye. $To invoke the ftp command with automatic logon (using the .netrc file), open a session with the system
canopus, log in, change the working directory to the parent directory, print the working directory, list the contents of the current directory, delete a file, write a listing of the contents of the current directory to a local file, close the session, and then quit, enter:$ ftp canopus Connected to canopus.austin.century.com. 220 canopus.austin.century.com FTP server (Version 4.1 Sat Nov 23 12:52:09 CST 1991) ready. 331 Password required for dee. 230 User dee logged in. ftp> cdup 250 CWD command successful. ftp> pwd 257 "/home" is current directory. ftp> dir 200 PORT command successful. 150 Opening data connection for /usr/bin/ls (128.114.4.99,1407) (0 bytes). total 104 drwxr-xr-x 2 system 32 Feb 23 17:55 bin Drwxr-xr-x 26 rios 4000 May 30 17:18 bin1 drwxr-xr-x 2 system 32 Feb 23 17:55 books drwxrwxrwx 18 rios 1152 Jun 5 13:41 dee -r--r--r-- 1 system 9452 May 17 12:21 filesystems drwxr-xr-x 2 system 32 Feb 23 17:55 jim drwxr-xr-x 5 system 80 Feb 23 17:55 krs drwxrwxrwx 2 rios 16432 Feb 23 17:36 lost+found -rwxr-xr-x 1 rios 3651 May 24 16:45 oldmail drwxr-xr-x 2 system 256 Feb 23 17:55 pubserv drwxrwxrwx 2 system 144 Feb 23 17:55 rein989 drwxr-xr-x 2 system 112 Feb 23 17:55 reinstall 226 Transfer complete. ftp> delete oldmail 250 DELE command successful. ftp> mdir /home/dee/bin binlist output to local-file: binlist? y 200 PORT command successful. 150 Opening data connection for /usr/bin/ls (128.114.4.99,1408) (0 bytes). 226 Transfer complete.
ftp> close
221 Goodbye.
ftp> quit
$
- To return to the ftp prompt on being blocked after a file transfer between a local and a remote host (for example, from AIX FTP client to Windows FTP server), enter:
$ ftp -M hostname
파일
| 파일 | 설명 |
|---|---|
/usr/samples/tcpip/netrc |
.netrc 견본 파일 |
/etc/syslog.conf |
syslogd 데몬 구성 정보 |
영어 원문
- /usr/samples/tcpip/netrc — Contains the sample .netrc file.
- /etc/syslog.conf — Contains configuration information for the syslogd daemon.
Related reference:
- “ftpd Daemon”
Related information:
- stty command
- telnet command
- tftp command
- syslogd command
- File transfers using the ftp and rcp commands
리눅스(GNU)와 다른 점
리눅스에도 ftp(netkit 또는 tnftp) 클라이언트가 있고 하위 명령이 거의 같습니다. 자동화에는 lftp(재시도, 미러링, mirror -R), curl -T 파일 ftp://호스트/, wget ftp://...를 많이 씁니다. TLS는 lftp의 set ftp:ssl-force true나 curl --ssl-reqd로 씁니다. 다만 요즘은 FTP 대신 scp, sftp, rsync -e ssh를 권합니다.