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