Install and start the FTP service
Use
apt-get
Installationvsftpd
sudo Install vsftpd-y
After the installation is complete, VSFTPD automatically starts
netstat
command to see that the system has21 ports monitored.
sudo grep +
If it does not start, you can manually turn on the VSFTPD service:
sudo systemctl start Vsftpd.service
sudo mkdir /home/uftp
When you're done, you can see the new folder Uftp here/home/uftp.
- Create a login Welcome file
sudo Touch /home/uftp/welcome.txt
- Create a new user uftp and set a password
Create a user
uftp
sudo useradd-d/home/uftp-s/bin/bash uftp
- Set a password for a user
uftp
sudo passwd uftp
- Remove the vsftpd in PAM.D because the profile causes the FTP to fail to log on with the user name:
sudo passwd uftp
- Restrict the user to access via FTP only
Restrict users
uftp
You can access the server only through FTP, not directly to the server:
sudo usermod-s/sbin/nologin uftp
- Modifying the VSFTPD configuration
sudo chmod A +w /etc/vsftpd.conf
- Modify the configuration in the/etc/vsftpd.conf file (add the following configuration directly to the bottom of the configuration file):
# Restrict users to directories outside the home directory access Chroot_local_user=ftp user list Userlist_deny=nouserlist_ Enable=ftp user list userlist_file=/etc/vsftpd.user_list# does not configure 530 issues that can cause inexplicable seccomp_ Sandbox=no# allow file upload write_enable=yes# use UTF8 encoding utf8_filesystem=yes
- Create a new file to
/etc/vsftpd.user_list
hold users who are allowed to access ftp:
sudo Touch /etc/vsftpd.user_listsudochmod A +w /etc/vsftpd.user_list
- Modify/etc/vsftpd.user_list to join the user you just created:
Vsftpd.user_listuftp
Set Home Directory access rights (read only):
sudo chmod A-w /home/uftp
- Create a new public directory and set permissions (Read and write):
sudo mkdir sudo chmod 777 -r/home/uftp/public
- Restart the VSFTPD service:
sudo systemctl restart Vsftpd.service
Ubuntu FTP Server