Hướng dẫn cài đặt VSFTPD trên Ubuntu 16.04/18.04

1. Update các gói cho hệ điều hành.
apt-get update
apt-get upgrade
2. Cài đặt VSFTPD:
apt-get install vsftpd
3. Cấu hình VSFTPD:
– Backup cấu hình cũ bằng lệnh:
mv /etc/vsftpd.conf /etc/vsftpd.conf_orig
- Tạo file cấu hình mới bằng lệnh:
vim /etc/vsftpd.conf
Nội dung của file cấu hình như bên dưới:
listen=NO
listen_ipv6=YES
anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
dirmessage_enable=YES
use_localtime=YES
xferlog_enable=YES
connect_from_port_20=YES
chroot_local_user=YES
secure_chroot_dir=/var/run/vsftpd/empty
pam_service_name=vsftpd
rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
ssl_enable=NO
pasv_enable=Yes
pasv_min_port=10000
pasv_max_port=10100
allow_writeable_chroot=YES
4. Mở port trên firewall
Tiếp theo chúng ta mở port để dịch vụ FTP hoạt động cũng như port cho FPT hoạt động ở chế độ Passive mode:
ufw allow from any to any port 20,21,10000:10100 proto tcp
Kích hoạt chế độ khởi động VSFTPD theo hệ điều hành và bật dịch vụ:
systemctl restart vsftpd
systemctl enable vsftpd
Để chắc chắn xem dịch vụ có chạy hay không chúng ta sử dụng lênh:
systemctl status vsftpd
Nếu kết quả hiện ra như bên dưới thì chúc mừng bạn đã cài đặt và cấu hình thành công. Nếu có lỗi bạn vui lòng đọc log để tìm xem sai chỗ nào để sửa lại trong file config:
6. Tạo user FTP và test thử:
Chúng ta sẽ khởi tạo 1 user để sử dụng dịch vụ FTP là lionel bằng các lệnh:
passwd lionel 
Enter new UNIX password: 123456
Retype new UNIX password: 123456
passwd: password updated successfully
Sau đó dùng ftp đăng nhập như sau :)))
https://prntscr.com/m98w82
Tham khảo thêm:
https://www.bkns.vn/huong-dan-cai-dat-vsftpd-tren-ubuntu-16-04-18-04.html
https://www.hostinger.vn/huong-dan/lam-nao-de-dung-ftp-server-tren-ubuntu-vps/#gref

Last updated