Setup vsftpd » Historie » Version 2
Jeremias Keihsler, 04.07.2020 15:42
1 | 1 | Jeremias Keihsler | h1. Install |
---|---|---|---|
2 | |||
3 | <pre><code class="bash"> |
||
4 | yum install vsftpd |
||
5 | </code></pre> |
||
6 | |||
7 | h2. create user |
||
8 | |||
9 | <pre><code class="bash"> |
||
10 | adduser userftp |
||
11 | passwd userftp |
||
12 | </code></pre> |
||
13 | disable the ssh login and enable just for ftp |
||
14 | <pre><code class="bash"> |
||
15 | usermod -s /sbin/nologin userftp |
||
16 | </code></pre> |
||
17 | |||
18 | h2. setup config |
||
19 | |||
20 | edit @/etc/vsftpd/vsftpd.conf@ |
||
21 | <pre> |
||
22 | ... |
||
23 | anonymous_enable=NO |
||
24 | ... |
||
25 | local_enable=YES |
||
26 | 2 | Jeremias Keihsler | |
27 | 1 | Jeremias Keihsler | </pre> |
28 | |||
29 | h2. enable and start service |
||
30 | |||
31 | <pre><code class="bash"> |
||
32 | 2 | Jeremias Keihsler | systemctl start vsftpd.service |
33 | systemctl stop vsftpd.service |
||
34 | systemctl enable vsftpd.service |
||
35 | 1 | Jeremias Keihsler | </code></pre> |
36 | |||
37 | h2. setup firewall |
||
38 | |||
39 | open port 21 |
||
40 | |||
41 | <pre><code class="bash"> |
||
42 | iptables --list |
||
43 | iptables -I INPUT 1 -p tcp --dport 21 -j ACCEPT |
||
44 | /etc/init.d/iptables save |
||
45 | </code></pre> |
||
46 | |||
47 | h2. troubleshoot |
||
48 | |||
49 | if you can connect but get a @500 OOPS: cannot change directory@ most likely this is due to the fact that Selinux doesn't allow access to the users home-directory. You can fix this by: |
||
50 | <pre><code class="bash"> |
||
51 | setsebool -P ftp_home_dir 1 |
||
52 | </code></pre> |