This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
ftp-install [2020/10/26 16:06] – gwsadmin | ftp-install [2020/12/04 10:50] – gwsadmin | ||
---|---|---|---|
Line 4: | Line 4: | ||
<code language-bash> | <code language-bash> | ||
- | 'sudo apt update && sudo apt install vsftpd | + | sudo apt update && sudo apt install vsftpd |
Line 62: | Line 62: | ||
</ | </ | ||
- | ===== Configure vsftpd | + | ==== Configure vsftpd ==== |
* Rename config file | * Rename config file | ||
Line 82: | Line 82: | ||
* Paste in the following | * Paste in the following | ||
- | < | + | < |
- | 'listen=NO | + | listen=NO |
listen_ipv6=YES | listen_ipv6=YES | ||
anonymous_enable=NO | anonymous_enable=NO | ||
Line 99: | Line 99: | ||
pasv_min_port=40000 | pasv_min_port=40000 | ||
pasv_max_port=50000 | pasv_max_port=50000 | ||
+ | allow_writeable_chroot=YES | ||
</ | </ | ||
Line 108: | Line 108: | ||
<code language-bash> | <code language-bash> | ||
sudo systemctl restart vsftpd | sudo systemctl restart vsftpd | ||
+ | |||
</ | </ | ||
+ | |||
+ | Now, if this was purely to just upload files we can stop here, however, normally you want to FTP a site that is for the web, so we need to be able to have the FTP user/group work in tandem with the www-data user/group. | ||
+ | |||
+ | So, here is what is needed: | ||
+ | |||
+ | * Create a new group (www-pub) and add the users to that group | ||
+ | |||
+ | <code bash> | ||
+ | sudo groupadd www-pub | ||
+ | |||
+ | |||
+ | </ | ||
+ | |||
+ | * Add FTP user AND www-data to the group | ||
+ | |||
+ | <code bash> | ||
+ | usermod -a -G www-pub ftpuser | ||
+ | |||
+ | usermod -a -G www-pub www-data | ||
+ | |||
+ | |||
+ | </ | ||
+ | |||
+ | * Check that the users are part of all groups | ||
+ | |||
+ | <code bash> | ||
+ | sudo groups ftpuser | ||
+ | |||
+ | sudo groups www-data | ||
+ | |||
+ | |||
+ | </ | ||
+ | |||
+ | * Change ownership of everything under the web directory | ||
+ | |||
+ | <code bash> | ||
+ | sudo chown -R root: | ||
+ | |||
+ | |||
+ | </ | ||
+ | |||
+ | * Then change the permissions (or certain web sites won't work - such as NextCloud or WHMCS) | ||
+ | |||
+ | <code bash> | ||
+ | sudo chmod 2775 / | ||
+ | |||
+ | |||
+ | </ | ||
+ | |||
+ | * In detail, this is what each number is doing:// | ||
+ | |||
+ | **Then you should be able to FTP to a site without changing permissions all over the place!** | ||