FTP non-interactive mode file transfer

Source: Internet
Author: User
Tags format command line contains ftp ftp commands file transfer protocol root directory

FTP (Filetransferprotocol) is a file transfer protocol through which you can transfer or transfer from a computer to a computer file. FTP commands can be used interactively or in a noninteractive manner. The use of interactive mode is simpler, the system will be prompt when the command executes, the implementation of non-interactive method is complicated, but it is very convenient for users, because FTP will automatically complete all operations. We use FTP command, in order to operate conveniently, will often be used in a non-interactive manner, the following author on the introduction of SCOUNIX3.0 under the FTP implementation of the non interactive mode of processing.

In Unix systems, the RCP command enables remote file transfers, but both must be of the same system, and RCP is powerless if it is remote to another system. Using the FTP command not only enables you to transfer the side pieces in a non-interactive way, but also when both sides use different systems. The use of FTP commands under UNIX differs from WindowsNT, and the FTP command format is known through the UNIX Help system:

Ftp[-v][-d][-i][-n][-t][-g][host]

As you can see from the command format, its command parameters are basically the same as under the WindowsNT system, but there is no [-s:filename] parameter, that is, you can't transfer files by editing an arbitrary text file, but it's a pleasure to When executed, the FTP command searches for a file named Netrc, and executes the command line in the Netrc file if the file exists and contains the hostname specified in the FTP command line. The Netrc file contains the remote host name, registered user name, user password, and defined macros, in the following format:

The following are the referenced contents:
Machine Host Name
Login user Name
Password user password
Macdefinit (defining macros)
Binary
Hash
Get remote host filename local file name
Bell
Close
Bye

You can automatically transfer files by running the FTP host name command at the command prompt. In addition, using FTP commands under UNIX should pay attention to the following matters.

1. In the. netrc file, if you use the password command and the user password is not encrypted in the file, you must set permissions on the. netrc file, and you can use the "chmod0600.netrc" command at the command prompt to set permissions, that is, only their file master has read and write permissions, The password command is invalid and the registration process is interrupted if the group member and other use members do not have any permissions.

2. In the. netrc file, if you use the Macdefinit command, the following line can enter the FTP command, and the system executes the commands automatically until you encounter a blank line, which means that there must be at least one line at the end of the file, or an error message appears. Macrodefinitionmissingnulllineterminator ".

3. If you are using Superuser registration under a UNIX system, the. netrc file must be placed under the root directory, and if you are registering with a normal user, the. netrc file must be placed under the/usr/user name directory.

4, in the UNIX system all commands are lowercase, including FTP commands.



Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.