Analysis of non-interactive FTP file transmission principles
Source: Internet
Author: User
Article title: Analysis of FTP non-interactive file transmission principles. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
FTP (File Transfer Protocol) is a File Transfer Protocol that can be transmitted from or to a computer. FTP commands can be used in interactive mode or non-interactive mode. The interaction method is relatively simple, and the system will gradually prompt when executing commands. non-interaction implementation is complicated, but it is very convenient for users, because FTP will automatically complete all the operations. When using FTP commands, FTP is often used in non-interactive mode for ease of operation. The following describes how to implement non-interactive FTP processing in sco unix 3.0.
In UNIX systems, the RCP command can be used for remote file transmission, but both parties must be in the same system. if the remote system is another system, RCP will be powerless. Using the FTP command can not only implement non-interactive transmission of parts, but also be used when both parties use different systems. The use of FTP commands in UNIX is different from that in Windows NT. the help system of UNIX can tell that the FTP command format is:
Ftp [-v] [-d] [-I] [-n] [-t] [-g] [host]
It can be seen from the command format that the command parameters are basically the same as in Windows NT, but there is no [-s: FILENAME] parameter, that is, you cannot edit any text file to transfer files in non-interactive mode. However, the ftp command will find a file named netrc during execution, if the file exists and contains the host name specified in the FTP command line, the command line in the netrc file is executed. The netrc file contains the remote host name, registered user name, user password, and defined macro. the format is as follows:
Machine host name
Login username
Password user password
Macdefinit (definition macro)
Binary
Hash
Get remote host file name local file name
Bell
Close
Bye
Run the "ftp host name" command at the command prompt to automatically transfer files. In addition, pay attention to the following when using FTP commands in UNIX.
1. in. in the netrc file, if the password command is used, the user password is not encrypted in the file. set permissions for the netrc file. you can use "chmod 0600. the "netrc" command is used to set permissions, that is, only the file owner has read and write permissions, and members of the group and other users cannot have any permissions. Otherwise, the password command is invalid and the registration process is interrupted.
2. in. in the netrc file, if you use the macdefinit command, you can enter the FTP command in the next line. The system will automatically execute these commands until an empty line is encountered, that is, there must be at least one line of blank lines at the end of the file, otherwise, the error message "Macro definition missing null line terminator" appears ".
3. if you use a super user registration in a UNIX system. the netrc file must be placed in the root directory. the netrc file must be in the "/usr/username" directory.
4. all commands in UNIX are in lowercase, including FTP commands.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service