Rocky Linux8.6 : FTP Server

Install FTP Server

1. Instaa  Vsftpd

# dnf -y install vsftpd

2.Vsftpd configuration

Save the unedited vsftpd.conf with .bak
# cp /etc/vsftpd/vsftpd.conf /home/huong/vsftpd.conf.bak
①Editing Configuration Files
# vi /etc/vsftpd/vsftpd.conf
# Line 12 : No anonymous login (confirmed)
# Line 39:Log transfer records (confirmation)
# Line 82,83 : Uncomment ( Allow transfer in ASCII mode )
# Line 100,101 :Uncomment ( chroot enabled )
# Line 103 : Uncomment ( chroot list file specified )
# Line 109 : Uncomment (directory batch transfer enabled)
# Line 114 : Change (Enable IPv4)
# Line 123 : Change (IPv6 is ignored)
### Add to last line###
# Use local time
②Add users to allow directory access to upper level
# echo "huong" >> /etc/vsftpd/chroot_list
In my case I wrote huong.
③ Specify IP addresses to allow connections in /etc/hosts.allow
# echo "vsftpd:" >> /etc/hosts.allow is the setting that allows all local IP addresses in my environment.
Write vsftpd:ALL (deny all connections) in /etc/hosts.deny
# echo "vsftpd:ALL" >> /etc/hosts.deny
This setting overrides hosts.allow. That is, everything is denied, and IP addresses specified in hosts.allow are allowed.
④Enable vsftpd autostart and start it
# systemctl enable vsftpd
Created symlink /etc/systemd/system/ → /usr/lib/systemd/system/vsftpd.service.
# systemctl start vsftpd
⑤From windows side, check if you can connect with FileZilla.
Open the ftp port with firewall before connecting
# firewall-cmd --permanent --add-service=ftp
# firewall-cmd --reload
Start FileZilla and change FileZilla settings first, menu "Edit" "Settings"
"Connection" and "SFTP" in the left pane
Click "Add key File" in the right pane
Open "id_rsa.ppk" saved in Windows
Click "OK"
In the "Password" field, enter the password you set when you created your SSH public key.
Return to the initial screen and select "Site Manager" from the "File" menu.
Click on "New site  ↓
Enter the following settings for each item and click "Connect"
Protocol : SFTP-SSH File Transfer Protocol
Host : Server IP address
Port : 2244(SSH Port number)
Logon Type : Ask for password
User  : General user name (server login user)
Click "OK" when the following screen appears
In the "Password" field, enter the password you set when you created your SSH public key.
If the connection is successful, the server directory is displayed on the right and the Windows directory on the left.  ↓