Setup vsftpd » Historie » Version 1
Jeremias Keihsler, 04.07.2020 15:37
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 | ... |
||
27 | chroot_local_user=YES |
||
28 | </pre> |
||
29 | |||
30 | h2. enable and start service |
||
31 | |||
32 | <pre><code class="bash"> |
||
33 | chkconfig vsftpd on |
||
34 | /etc/init.d/vsftpd start |
||
35 | </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> |