setting-up-ftp
1 Creating an FTP User
- Install vsftpd on the server:
sudo apt update && sudo apt install vsftpd -y
- Create a new user for FTP access:
sudo adduser ftpuser
- Assign proper directory permissions:
sudo mkdir -p /home/ftpuser/ftp
sudo chown nobody:nogroup /home/ftpuser/ftp
sudo chmod a-w /home/ftpuser/ftp
The ftp directory is created and owned by nobody:nogroup to restrict write access.
2 Configuring FTP Access
- Open the vsftpd configuration file:
sudo nano /etc/vsftpd.conf
Modify the following settings:
anonymous_enable=NO
local_enable=YES
chroot_local_user=YES
allow_writeable_chroot=YES
- anonymous_enable=NO: Disables anonymous access.
- local_enable=YES: Allows local system users to log in.
- chroot_local_user=YES: Restricts users to their home directory.
- allow_writeable_chroot=YES: Prevents vsftpd from denying access due to chroot restrictions.
- Restart the FTP service to apply changes:
sudo systemctl restart vsftpd
- Enable FTP service on boot:
sudo systemctl enable vsftpd
3 Testing FTP Connectivity
- Verify that the FTP server is running:
sudo systemctl status vsftpd
Use an FTP client such as command-line FTP to test access:
ftp ftpuser@<server-ip>
- Log in with the credentials of the created user.
