Redhat Linux FTP Configuration

Source: Internet
Author: User
Tags ftp client file transfer protocol

Redhat Linux FTP Configuration File Transfer Protocol (FTP: FileTransfer Protocol) enables files to be shared between hosts. FTP uses TCP to generate a virtual connection for controlling information, and then generates a separate TCP connection for data transmission. Control connections use TELNET-like protocols to exchange commands and messages between hosts. The file transfer protocol is used by two computers on the TCP/IP network to transfer files. FTP is one of the earliest protocols used on the TCP/IP network and the INTERNET, it belongs to the application layer of the network protocol group. The FTP client can send commands to the server to download files, upload files, and create or change directories on the server. Ftp uses TCP as the transport layer protocol, while tftp uses UDP. There are FTP services in Linux. FTP is divided into server and client. A machine acts as an FTP server and needs to start the vsftpd service, and another machine acts as the client, the rpm package with ftp or lftp needs to be installed. First check whether the machine is installed with ftp-related rpm package [plain] [root @ localhost Packages] # rpm-qa | grep ftp report-plugin-ftp-0.18-7.el6.i686 vsftpd-2.2.2-6.el6.i686 report-config-ftp-0.18-7.el6.i686 gvfs-obexftp-1.4.3-9.el6.i686 if not installed, you can mount the RedHat installation package, find [plain] [root @ localhost nfs] # mount-t vboxsf RedHat_Share/home/Wentasy/share [root @ localhost nfs] # ll total 4-rw in the Packages directory -rw -. 1 root 12 Jul 21 :22 file1 [root @ local Host nfs] # cd/home/Wentasy/s share/software/sysctl. conf [root @ localhost nfs] # cd/home/Wentasy/share/[root @ localhost share] # ll total 2862360-rwxrwxrwx. 1 root 2931056640 Feb 23 2012 rhel-server-6.0-i386-dvd.iso [root @ localhost share] # mount-o loop rhel-server-6.0-i386-dvd.iso/mnt [root @ localhost share] # cd/mnt [root @ localhost share] # cd packages [root @ localhost Packages] # find. -nam E "* ftp *". /ftp-0.17-51.1.el6.i686.rpm. /gvfs-obexftp-1.4.3-9.el6.i686.rpm. /lftp-4.0.9-1.el6.i686.rpm. /report-config-ftp-0.18-7.el6.i686.rpm. /report-plugin-ftp-0.18-7.el6.i686.rpm. /tftp-0.49-5.1.el6.i686.rpm. /tftp-server-0.49-5.1.el6.i686.rpm. /vsftpd-2.2.2-6.el6.i686.rpm installation ftp-xxx.i686.rpm and lftp-xxxi686.rpm [plain] [root @ localhost Packages] # rpm-ivh ftp-0.17-51.1.el6.i686.rpm warning: ftp-0.1 7-51.1.el6.i686.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY Preparing... ######################################## ### [100%] 1: ftp ####################################### #### [100%] [root @ localhost Packages] # rpm-ivh lftp-4.0.9-1.el6.i686.rpm warning: lftp-4.0.9-1.el6.i686.rpm: headv3 RSA/SHA256 Signature, key ID fd431d51: NOKEY Preparing... ##################################### ###### [100%] 1: lftp ####################################### #### [100%] Start the ftp Server Service (Service name: vsftpd ), client. [Plain] [root @ localhost Packages] # service vsftpd status vsftpd is stopped [root @ localhost Packages] # service vsftpd start Starting vsftpd for vsftpd: [OK] Go to the/var/ftp/pub/directory, create a file [plain] [root @ localhost Packages] # cd/var/ftp/pub/[root @ localhost pub] # echo "hello"> file [root @ localhost pub] # ll total 4-rw-r --. 1 root 6 Jul 21 file log on to the server as an anonymous user. The default access directory is/var/ftp/. We can download the file to the current directory. Log on as an anonymous user and cannot upload files. [Plain] [Wentasy @ localhost test] $ lftp 169.254.140.100 lftp 169.254.140.100:/> get file get: Access failed: 550 Failed to open file. lftp 169.254.140.100:/> ls drwxr-xr-x 2 0 0 4096 Jul 21 40 pub lftp 169.254.140.100:/> cd pub lftp 169.254.140.100:/pub> pwd ftp: // 169.254.140.100/pub lftp 169.254.140.100:/pub> get file 6 bytes transferred lftp 169.254.140.100:/pub> exit [Wentasy @ localhost test] $ Ll total 4-rw-r --. 1 Wentasy 6 Jul 21 file 40 file [Wentasy @ localhost test] $ echo "hello world"> upload [Wentasy @ localhost test] $ ll total 8-rw-r --. 1 Wentasy 6 Jul 21 :40 file-rw-r --. 1 Wentasy 12 Jul 21 10:46 upload [Wentasy @ localhost test] $ lftp 169.254.140.100 lftp 169.254.140.100: ~> Put/home/Wentasy/test/upload. put: Access failed: 550 Permission denied. (upload) put:/home/Wentasy/test /.: Is a directory lftp 169.254.140.100:/> put/home/Wentasy/test/upload/root put: Access failed: 550 Permission denied. (upload) put:/root: Permission denied Log On As a common user. Note: we do not recommend using the root user log on, and the production environment will not allow you to log on as a root user. There are two ways to log on with a common user: [plain] [Wentasy @ localhost test] $ lftp Wentasy@169.254.140.100 Password: lftp Wentasy@169.254.140.100: ~> Exit [Wentasy @ localhost test] $ lftp-u Wentasy 169.254.140.100 Password: lftp Wentasy@169.254.140.100: ~> After logging on to the system, we can perform get, put, mirror-R, and mirror operations. [Plain] lftp Wentasy@169.254.140.100: ~> Put/home/Wentasy/test/upload 12 bytes transferred lftp Wentasy@169.254.140.100 :~ /Test> mirror/home/Wentasy/test/. Total: 1 directory, 3 files, 0 symlinks lftp Wentasy@169.254.140.100 :~ /Test> mirror-R/home/Wentasy/test2. total: 1 directory, 3 files, 0 symlinks New: 3 files, 0 symlinks To be removed: 0 directories, 3 files, 0 symlinks ftp usage ftp [-vdng] [User Name: password @ <FQDN>] | <IP address> | <Host Name> <IP address>: the IP address of the FTP server to be connected FQDN-v: Display All response information of the remote server-d: access the FTP server through debugging-n: Restrict automatic ftp logon. That is, when you log on to the FTP server, it is not automatically executed. the netrc file can be used in FTP! [Command [parameter]: Execute the command open <FQDN >|< IP address>: open the specified FTP server bye: exit the cd directory during FTP session: switch the current directory of the FTP server. Dir [Directory] [local file]: displays the FTP Server Directory and saves the result to the local file put: Upload a single file to the FPT server mput: upload multiple files to the FTP server get file: Download a single file from the FTP server to the local directory mget file: Download multiple files from the FTP server to the local directory delete file name: file case on the FTP server: when using mget, convert uppercase letters in the remote host file name to lowercase letters pwd: displays the current working directory of the remote host. Rmdir directory name: Delete the directory on the FTP server lftp command use lftp ftp: // [User name: password @] <FQDN >|< IP address> [: Port] lftp ftp: // <FQDN> | <IP address>-p port-u user name, password help: view all available commands ls: display the FTP server file list! Ls: display the local file list cd: Switch the remote directory! Cd: switch to the local directory get: Download a single file from the FTP server to the local directory mget: Download multiple files from the FTP server to the local directory pget: use multiple threads to download the remote file put: Upload a single file to the FTP server mput: upload multiple files to the FTP server mv: The file rm on the mobile FTP Server: delete files on the FTP server (using the-r recursive deletion parameter) mrm: delete multiple directories on the FTP server mkdir: create a directory on the FTP server pwd: display All FTP server directories lpwd: Display local directory exit: exit ftp session

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.