You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/guides/file_sharing/secure_ftp_server_vsftpd.md
+14-13Lines changed: 14 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,17 +20,18 @@ tags:
20
20
21
21
## Introduction
22
22
23
-
`vsftpd` is the Very Secure FTP Daemon (FTP being the file transfer protocol). It has been available for many years now, and is actually the default FTP daemon in Rocky Linux, and many other Linux distributions.
23
+
`vsftpd` is the Very Secure FTP Daemon (FTP being the file transfer protocol). It has been available for many years, and is the default FTP daemon in Rocky Linux and many other Linux distributions.
24
24
25
-
`vsftpd` allows for the use of virtual users with pluggable authentication modules (PAM). These virtual users do not exist in the system, and have no other permissions except to use FTP. If a virtual user gets compromised, the person with those credentials will have no other permissions after gaining access as that user. Using this setup is very secure indeed, but does require a bit of extra work.
25
+
`vsftpd` allows for the use of virtual users with pluggable authentication modules (PAM). These virtual users do not exist in the system and have no other permissions except FTP. If a virtual user gets compromised, the person with those credentials will have no other permissions after gaining access as that user. This setup is very secure but requires a bit of extra work.
26
26
27
27
!!! tip "Consider `sftp`"
28
28
29
-
Even with the security settings used here to set up `vsftpd`, you may want to consider `sftp` instead. `sftp` will encrypt the entire connection stream and is more secure for this reason. We have created a document called [Secure Server - `sftp`](../sftp) that deals with setting up `sftp` and the locking down SSH.
29
+
Even with the security settings used here to set up `vsftpd`, you may want to consider `sftp` instead. `sftp` will encrypt the entire connection stream and is more secure. We have created a document called [Secure Server - `sftp`](../sftp) that deals with setting up `sftp` and the locking down SSH.
30
30
31
31
## Installing `vsftpd`
32
32
33
-
You also need to ensure the installation of `openssl`. If you are running a web server, this probably **is** already installed, but just to verify you can run:
33
+
You must also ensure the `openssl` installation. If you are running a web server, this probably **is** already installed, but just to verify you can run:
34
+
34
35
35
36
```
36
37
dnf install vsftpd openssl
@@ -46,7 +47,7 @@ Do not start the service just yet.
46
47
47
48
## Configuring `vsftpd`
48
49
49
-
You want to ensure the disabling of some settings and the enabling of others. Generally, when you install `vsftpd`, it includes the most sane options already set. It is still a good idea to verify them.
50
+
You want to ensure the disabling of some settings and enabling others. Generally, installing `vsftpd` includes the most sane options already set. It is still a good idea to verify them.
50
51
51
52
To check the configuration file and make changes when necessary, run:
52
53
@@ -66,7 +67,7 @@ Ensure that "local_enable" is yes:
66
67
local_enable=YES
67
68
```
68
69
69
-
Add a line for the local root user. If the server that you are installing this on is a web server, our assumption is that you will be using the [Apache Web Server Multi-Site Setup](../web/apache-sites-enabled.md), and that your local root will reflect that. If your setup is different, or if this is not a web server, adjust the "local_root" setting:
70
+
Add a line for the local root user. If the server is a web server, and you use the [Apache Web Server Multi-Site Setup](../web/apache-sites-enabled.md), your local root will reflect that. If your setup is different, or if this is not a web server, adjust the "local_root" setting:
70
71
71
72
```
72
73
local_root=/var/www/sub-domains
@@ -98,7 +99,7 @@ nopriv_user=vsftpd
98
99
guest_username=vsftpd
99
100
```
100
101
101
-
You need to add a section near the bottom of the file to force encryption of passwords sent over the internet. You need `openssl` installed and you will need to create the certificate file for this also.
102
+
You need to add a section near the bottom of the file to force encryption of passwords sent over the internet. You need `openssl` installed and you must also create the certificate for this.
102
103
103
104
Start by adding these lines at the bottom of the file:
104
105
@@ -161,7 +162,7 @@ Next is the organizational unit name. You can fill this in if the server is for
161
162
Organizational Unit Name (eg, section) []:
162
163
```
163
164
164
-
The the next field needs filling in, but you can decide how you want it. This is the common name of your server. Example: `webftp.domainname.ext`:
165
+
The following field needs filling in, but you can decide how you want it. This is the common name of your server. Example: `webftp.domainname.ext`:
165
166
166
167
```
167
168
Common Name (eg, your name or your server's hostname) []:
@@ -177,7 +178,7 @@ When completed, the certificate creation will occur.
177
178
178
179
## <aname="virtualusers"></a>Setting up virtual users
179
180
180
-
As stated earlier, using virtual users for `vsftpd` is much more secure because they have no system privileges at all. That said, you need to add a user for the virtual users to use. You also need to add a group:
181
+
As stated earlier, using virtual users for `vsftpd` is much more secure because they have no system privileges. That said, you need to add a user for the virtual users. You also need to add a group:
181
182
182
183
```
183
184
groupadd nogroup
@@ -192,7 +193,7 @@ Go to the configuration directory for `vsftpd`:
192
193
cd /etc/vsftpd
193
194
```
194
195
195
-
You need to create a password database. You use this database to authenticate our virtual users. You need to create a file to read the virtual users and passwords from. This will create the database.
196
+
You need to create a password database. You use this database to authenticate our virtual users. You need to create a file to read the virtual users and passwords. This will create the database.
196
197
197
198
In the future, when adding users, you will want to duplicate this process again:
198
199
@@ -281,7 +282,7 @@ This will enable login for your virtual users defined in `vsftpd-virtual-user.db
281
282
282
283
## Setting up the virtual user's configuration
283
284
284
-
Each virtual user has their own configuration file, which specifies their own "local_root" directory. Ownership of this local root is the user "vsftpd" and the group "nogroup".
285
+
Each virtual user has a configuration file, specifying their own "local_root" directory. Ownership of this local root is the user "vsftpd" and the group "nogroup".
285
286
286
287
Refer to [Setting Up Virtual Users section above.](#virtualusers) To change the ownership for the directory, enter this at the command line:
287
288
@@ -316,12 +317,12 @@ systemctl restart vsftpd
316
317
317
318
You can test your setup with the command line on a machine and test access to the machine with FTP. That said, the easiest way to test is to test with an FTP client, such as [FileZilla](https://filezilla-project.org/).
318
319
319
-
When you test with a virtual user to the server running `vsftpd`, you will get an SSL/TLS certificate trust message. This trust message is saying to the person that the server uses a certificate and asks them to approve the certificate before continuing. When connected as a virtual user, you will be able to place files in the "local_root" folder.
320
+
When you test with a virtual user to the server running `vsftpd`, you will get an SSL/TLS certificate trust message. This trust message tells the person that the server uses a certificate and asks them to approve it before continuing. You can place files in the "local_root" folder when connected as a virtual user.
320
321
321
322
If you are unable to upload a file, you might need to go back and verify each of the steps again. For instance, it might be that the ownership permissions for the "local_root" are not set to the "vsftpd" user and the "nogroup" group.
322
323
323
324
## Conclusion
324
325
325
-
`vsftpd` is a popular and common ftp server and can be a standalone server, or part of an [Apache Hardened Web Server](../web/apache_hardened_webserver/index.md). If set up to use virtual users and a certificate, it is quite secure.
326
+
`vsftpd` is a popular and common FTP server and can be a stand-alone server, or part of an [Apache Hardened Web Server](../web/apache_hardened_webserver/index.md). It is pretty secure if set up to use virtual users and a certificate.
326
327
327
328
This procedure has many steps to for setting up `vsftpd`. Taking the extra time to set it up correctly will ensure that your server is as secure as it can be.
0 commit comments