Build an FTP server in Linux and an ftp server in linux
In Linux, we use vsftp as our ftp server.
Server OS: Redhat 6.3
1. Check whether vsftpd is installed on the server.
Rpm-qa | grep vsftpd
2. If no vsftpd rpm package exists, we need to download and install
Yum install vsftpd
3. Configure the vsftpd configuration file.
# Ls/etc/vsftpd/
Ftpusers user_list vsftpd. conf vsftpd_conf_migrate.sh
Vim vsftpd. conf
Modify the value as follows:
Anonymous_enable =NO# Prohibit anonymous user logon
Local_enable = YES # Allow Local real users to log on
Write_enable = YES # allow users to upload data
Local_umask = 022 # permission to create a new directory (755) and a file (644)
Dirmessage_enable = YES # if there is a. message under the logon directory, the file content will be displayed. You can create a. message file in the logon directory and write information.
Xferlog_enable = YES # Start log file records, recorded in/var/log/xferlog
Connect_from_port_20 = YES # support for active connections
Xferlog_std_format = YES # log file formats supported by WuFTP
Local_root =/home/xx/ftp # Restrict login users to operate only in the/home/xx/ftp directory
Chroot_local_user = YES # Restrict login users to define the directory in the home directory local_root
Chroot_list listen = YES # Start vsftpd using stand alone
Pam_service_name = vsftpd # support for PAM module Management
Userlist_enable = YES # account logon control in the/etc/vsftpd/user_list file is supported
Tcp_wrappers = YES # firewall mechanism supporting TCP Wrappers
For security purposes, We can editUser_listThis file is used to add accounts that are prohibited from logging on to the system through FTP. In this case, these accounts attempt to log on remotely. Logon is denied.
Example:
> Ftp xxxxxxx
User (xxxxxx :( none): root
530 Permission denied.
Logon Failed.
I created an account test_ftp dedicated for ftp on the server, so in vsftpd. confLocal_root =/home/xx/ftp changedLocal_root =/home/test_ftp/ftp
In this way, files uploaded using the test_ftp account will be stored in the/home/test_ftp/ftp directory.
3. Restart the vsftpd service and try to use ftp to transfer files.
Service vsftpd restart
4. Open the command line on another machine:
Ftp xxxxxx
If the configuration is successful, you can use ftp to transfer files now.