Vsftpd installation and configuration
Check if there is vsftpd on this machine
rpm -qa | grep vsftpd
If it does not exist, download and install with yum
yum -y install vsftpd
For installation errors, please refer to yum installation configuration
https://blog.csdn.net/qq_39906884/article/details/84139028
Open vsftpd to
view the status
systemctl start vsftpd.service
systemctl status vsftpd.service
Set to boot
systemctl enable vsftpd.service
Vsftp server configuration file introduction
Main configuration file: /etc/vsftpd/vsftpd.conf
The user list file that controls access to the Vsftpd server:
- /etc/vsftpd/ftpusers
- /etc/vsftpd/user_list
Default directory for anonymous users: /var/ftp
User of the Vsftp server
- Local users (users who have an account, enter the account password to log in to the server, and directly enter the user's home directory).
- Anonymous users (no account, if the server provides anonymous access, enter the anonymous user name ftp or anonymous, you can log in without entering a password, and enter the anonymous FTP service directory /var/ftp).
Set the permissions for anonymous users to upload files and create directories.
Modify the /etc/vsftpd/vsftpd.conf file, and open the comments on the following two lines.
Modify SELinux permissions
setsebool -P ftpd_anon_write on
setsebool -P ftpd_full_access on
Modify the permissions of the /var/ftp/pub directory
chmod 777 /var/ftp/pub/
Restart the Vsftpd server
systemctl restart vsftpd.service
Create a test.txt file under /var/ftp/pub and add the content Hello World!.
touch /var/ftp/pub/test.txt
echo 'Hello World!' > /var/ftp/pub/test.txt
Open the firewall and check ftp
Use another virtual machine to log in to
see if there is ftp on this machine
rpm -qa | grep ftp
If not, download and install
yum -y install ftp
Create abc.txt file
and write it to Hello FTP!, which will be used for uploading later.
touch abc.txt
echo 'Hello FTP!' > abc.txt
connect to the server
ftp 服务器IP地址
Name Enter the ftp
password without entering it, just press Enter
Enter the pub directory, view the directory files
cd pub
ls
Download the test.txt file
get test.txt
Upload the abc.txt file
put abc.txt
Use exit to exit,
ls view the current directory,
and just download the test.txt file from the server.
exit
ls
cat test.txt
Switch to server
View /var/ftp/pub/abc.txt, you can view the content of abc.txt just uploaded by another virtual machine
cat /var/ftp/pub/abc.txt