vsftpd/service-install.sh

raw link view readme
1 yum install firewalld -y
2 systemctl start firewalld
3 systemctl enable firewalld
4 sed "s/\"80\"/\"40000\"/;s/WWW (HTTP)/Custom FTP Passive/;/<description>.*/d" /usr/lib/firewalld/services/http.xml > /etc/firewalld/services/ftp-passive.xml
5 firewall-cmd --reload
6 firewall-cmd --permanent --add-interface=eth0 --zone=public
7 firewall-cmd --permanent --add-service=ftp --zone=public
8 firewall-cmd --permanent --add-service=ftp-passive --zone=public
9 firewall-cmd --reload
10
11 yum install vsftpd -y
12
13 useradd user01 -m -s /bin/bash
14 echo "mypassword" | passwd user01 --stdin
15
16 setsebool -P ftp_home_dir 1
17
18 yum install vsftpd -y
19
20 sed -i.original -E "s/^#ftpd_banner=.*/ftpd_banner=present authorization or be destroyed/" /etc/vsftpd/vsftpd.conf
21 sed -i -E "s/^#chroot_local_user=.*/chroot_local_user=YES\nallow_writeable_chroot=YES/" /etc/vsftpd/vsftpd.conf
22 sed -i -E "s/^anonymous_enable=.*/anonymous_enable=NO/g;/^#/d" /etc/vsftpd/vsftpd.conf
23
24 cat >> /etc/vsftpd/vsftpd.conf << EOF
25 pasv_enable=Yes
26 pasv_max_port=40000
27 pasv_min_port=40000
28 EOF
29
30 systemctl start vsftpd
31 systemctl enable vsftpd
32
33 echo "test file" > /home/user01/something_to_download.txt
34 chown user01:user01 /home/user01/something_to_download.txt
35