Linux系统搭建FTP服务器步骤
Sure, here are the steps to set up an FTP server on Linux:
-
Install vsftpd (Very Secure FTP Daemon):
sudo apt-get update sudo apt-get install vsftpd -
Configure vsftpd: Edit the configuration file
/etc/vsftpd.confusing a text editor like nano or vim.sudo nano /etc/vsftpd.confModify the following configurations:
- Uncomment or add
write_enable=YESto allow write access. - Uncomment or add
local_umask=022to set file permissions. - Optionally, you can restrict users to their home directories by uncommenting
chroot_local_user=YES.
- Uncomment or add
-
Restart vsftpd: After making changes, restart the vsftpd service for the changes to take effect.
sudo systemctl restart vsftpd -
Open Firewall Ports: If you have a firewall enabled, allow connections on port 21, which is the default port for FTP.
sudo ufw allow 21/tcp -
Create FTP Users: You can create FTP users with their respective home directories.
sudo adduser ftpuser -
Set Permissions: Ensure that the permissions of the user's home directory and its contents are set appropriately.
sudo chmod 755 /home/ftpuser -
Test the FTP Server: You can now test the FTP server by connecting to it using an FTP client like FileZilla or the
ftpcommand-line tool.ftp your_server_ip
That's it! Your FTP server should now be set up and running on your Linux system.