From 27fb56d59af52a2d0f0a95e787a17b8dc28bd822 Mon Sep 17 00:00:00 2001 From: Sergio Ryan Date: Sun, 7 Jun 2020 21:04:20 +0800 Subject: [PATCH] FTP_USER entry now appended to virtual_users.txt instead of overwriting the whole file --- run-vsftpd.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/run-vsftpd.sh b/run-vsftpd.sh index 9ec8616..5d9656f 100644 --- a/run-vsftpd.sh +++ b/run-vsftpd.sh @@ -21,7 +21,10 @@ fi mkdir -p "/home/vsftpd/${FTP_USER}" chown -R ftp:ftp /home/vsftpd/ -echo -e "${FTP_USER}\n${FTP_PASS}" > /etc/vsftpd/virtual_users.txt +if ! grep -Fxq "${FTP_USER}" /etc/vsftpd/virtual_users.txt +then + echo -e "${FTP_USER}\n${FTP_PASS}" >> /etc/vsftpd/virtual_users.txt +fi /usr/bin/db_load -T -t hash -f /etc/vsftpd/virtual_users.txt /etc/vsftpd/virtual_users.db # Set passive mode parameters: