To use vsftpd to build an FTP server on the Ubuntu system, you can follow the following steps:
Install vsftpd:
Open a terminal and execute the following command to install vsftpd:
sudo apt update sudo apt install vsftpd
Configure vsftpd:
Use a text editor (such as nano or vi) to open the vsftpd configuration file:
sudo nano /etc/vsftpd.conf
In the configuration file, you can make the following changes or add as needed:
Enable anonymous access (if required):
anonymous_enable=YES
Disable anonymous uploads (if desired):
anon_upload_enable=NO
Enable local user access:
local_enable=YES
Set the list of users allowed to log in:
userlist_enable=YESuserlist_file=/etc/vsftpd.userlistuserlist_deny=NO
If you want to restrict users to their home directories, uncomment the following line:
chroot_local_user=YESchroot_list_enable=YESchroot_list_file=/etc/vsftpd.chroot_list
Create user:
If you want to allow local users to access the FTP server, you can create an FTP user. Execute the following command to create a new user:
sudo adduser ftpuser
Set the username and password according to the prompts.
Start the vsftpd service:
Execute the following command to start the vsftpd service:
sudo systemctl start vsftpd
Configure firewall:
If your system has a firewall enabled (such as ufw), you need to open the FTP data port. Execute the following command to allow FTP transfer:
sudo ufw allow 20/tcpsudo ufw allow 21/tcp
Now you have successfully set up an FTP server using vsftpd on the Ubuntu system. Please note that these steps are for Ubuntu systems, if you are using another Linux distribution, please consult the corresponding documentation or guide.
The above is the detailed content of Ubuntu system uses vsftpd to build FTP server.. For more information, please follow other related articles on the PHP Chinese website!