Red Hat Enterprise Linux 6.2 build an FTP server

Source: Internet
Author: User
Tags ftp commands

Red Hat Enterprise Linux 6.2 build an FTP server

My environment:
A: Red Hat Enterprise Linux 6.2 IP: 192.168.16.12 as the test end
B: Red Hat Enterprise Linux 6.2 IP: 192.168.16.13 this machine is used as the FTP server.
 
Set up an FTP server on machine B:
Download and install the vsftpd-2.2.2-6.el6_0.1.i686
[Root @ RedHat6-3 ~] # Rpm-ivh vsftpd-2.2.2-6.el6_0.1.i686.rpm
Create a test user:
[Root @ redhat6-3 ~] # Useradd bkjia-d/var/ftp/ttftp-s/sbin/nologin
[Root @ redhat6-3 ~] # Useradd bkjia-s/sbin/nologin
[Root @ redhat6-3 ~] # Passwd bkjia
New password:
Retype new password:
Passwd: all authentication tokens updated successfully.
 
View the New User Configuration
[Root @ redhat6-3 ~] # Tail-1/etc/passwd
Bkjia: x: 504: 504:/var/ftp/ttftp:/sbin/nologin
 
Modify the configuration file:
First, let's take a look at the vsftp configuration file. The common configuration is as follows:
[Root @ redhat6-3 ~] # Grep-v "#"/etc/vsftpd. conf
Anonymous_enable = YES // whether to enable Anonymous User Login
Local_enable = YES // whether to allow local user login
Write_enable = YES // whether the user is allowed to write data
Local_umask = 022 // default permission for creating files in the user directory. The default permission is 777-022 = 755.
Dirmessage_enable = YES
Xferlog_enable = YES // whether to use logs
Connect_from_port_20 = YES
Xferlog_std_format = YES
Listen = YES // whether to use the listener. If not, the super daemon is used.
Pam_service_name = vsftpd
Userlist_enable = YES
Tcp_wrappers = YES // whether the/etc/hosts. allow or/etc/hosts. deny file is enabled
The above is the default ftp parameter. We also need to add the following parameters to complete the Configuration:
Chroot_local_user = YES // whether the local user is prohibited from leaving his/her home directory
Xferlog_file =/var/log/vsftpd. log // set the ftp log Path
Idle_session_timeout = 600 // set the session wait time
Data_connection_timeout = 120 // set the data wait time
Ftpd_banner = Welcome to connect my FTP! // Set the logon prompt
 
After completing the configuration, restart ftp, view the process, and log on to server A for testing:
[Root @ redhat6-3 ~] # Netstat-antp | grep 21
Tcp 0 0 0.0.0.0: 111 0.0.0.0: * LISTEN 1221/rpcbind
Tcp 0 0 0.0.0.0: 21 0.0.0.0: * LISTEN 1926/vsftpd
Tcp 0 0: 111: * LISTEN 1221/rpcbind
The client needs to install ftp-0.17-51.1.el6.i686 to support ftp commands
On:
[Root @ redhat6-2 Packages] # rpm-ivh ftp-0.17-51.1.el6.i686.rpm
[Root @ redhat6-2 Packages] # ftp 192.168.16.13
Connected to 192.168.16.13 (192.168.16.13 ).
220 Welcome to connect my FTP!
Name (192.168.16.13: root): bkjia
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
Help Command to view ftp commands
Ftp> help
Commands may be abbreviated. Commands are:
! Debug mdir sendport site
$ Dir mget put size
Account disconnect mkdir pwd status
Append exit mls quit struct
Ascii form mode quote system
Bell get modtime recv sunique
Binary glob mput reget tenex
Bye hash newer rstatus tick
Case help nmap rhelp trace
Cd idle nlist rename type
Cdup image ntrans reset user
Chmod LCD open restart umask
Close ls prompt rmdir verbose
Cr macdef passive runique?
Delete mdelete proxy send
Create a directory and transfer a file to the directory:
Ftp> cd test
250 Directory successfully changed.
Ftp>! Ls
Anaconda-ks.cfg LAMP mysql-5.5.25.tar.gz
Install. log mysql-5.1.66-linux-i686-glibc23.tar.gz
Ftp> put mysql-5.5.25.tar.gz
Local: mysql-5.5.25.tar.gz remote: mysql-5.5.25.tar.gz
227 Entering Passive Mode (192,168 ).
150 OK to send data.
226 Transfer complete.
24639871 bytes sent in 1.1 secs (22359.01 Kbytes/sec)
Switch to the server to view the files in this directory:
[Root @ redhat6-3 ~] # Cd/var/ftp/ttftp/test/
[Root @ redhat6-3 test] # ls
Mysql-5.5.25.tar.gz
You can also log on to the ftp in windows for more convenience:
Open my computer and enter ftp: // bkjia@192.168.16.13


 
Configure the super daemon to start vsftp
Xinetd service management tools must be installed:
[Root @ redhat6-3 ~] # Rpm-ivh xinetd-2.3.14-33.el6.i686.rpm
[Root @ redhat6-3 ~] # Cp-rf/usr/share/doc/vsftpd-2.2.2/vsftpd. xinetd/etc/xinetd. d/vsftpd
[Root @ redhat6-3 ~] # Vi/etc/xinetd. d/vsftpd
# Default: off
# Description: The vsftpd FTP server serves FTP connections. It uses \
# Normal, unencrypted usernames and passwords for authentication.
Service ftp
{
Socket_type = stream
Wait = no
User = root
Server =/usr/sbin/vsftpd
Server_args =/etc/vsftpd. conf
Nice = 10
Disable = no // change yes to no.
Flags = IPv4
}
Modify configuration file
# Listen = YES
Just comment out the listen.
We recommend that you change write_enable = YES to NO.
 
Stop the vsftpd service:
[Root @ redhat6-3 xinetd. d] # service vsftpd stop
Shutting down vsftpd: [OK]
Restart the xinted service:
[Root @ redhat6-3 etc] # service xinetd restart
Stopping xinetd: [OK]
Starting xinetd: [OK]
Check whether the port exists:
[Root @ redhat6-3 etc] # netstat-antp | grep 21
Tcp 0 0 0.0.0.0: 111 0.0.0.0: * LISTEN 1221/rpcbind
Tcp 0 0 0.0.0.0: 21 0.0.0.0: * LISTEN 4369/xinetd
Tcp 0 0: 111: * LISTEN 1221/rpcbind
Because super processes are enabled to manage vsftp, the following error is reported when vsftpd is started:
[Root @ redhat6-3 etc] # service vsftpd start
Starting vsftpd for vsftpd: 500 OOPS: vsftpd: not configured for standalone, must be started from inetd
If you do not want to enable super process management, just remove the listen = YES comment in the configuration file.
 
Test the test end Logon:
[Root @ redhat6-2 ~] # Ftp 192.168.16.13
Connected to 192.168.16.13 (192.168.16.13 ).
220 Welcome to connect my FTP!
Name (192.168.16.13: root): bkjia
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
Ftp> bye
221 Goodbye.
Windows logon test:
Open my computer or cmd (call a browser) as you did in the same way as above input: tp: // bkjia@192.168.16.13/


 
Enter the user name and password, and then log on to the system.
 


 
Simple ftp server configuration is complete!

Build an ftp server on CentOS 7

Install and configure the FTP server in CentOS 7

Simple and practical Ubuntu FTP setup

Set up FTP server and Apache server on Ubuntu

Install the LAMP \ vsftpd \ Webmin \ phpMyAdmin service and settings in Ubuntu 13.04

Simple case of anonymous uploading of SeLinux and vsftpd on the RHEL6 Platform

Related Article

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.