Learn Linux Series (#2) - Proftpd management and configuration

View this thread on: d.buzz | hive.blog | peakd.com | ecency.com
·@vitusc·
0.000 HBD
Learn Linux Series (#2) - Proftpd management and configuration
**Learn Linux Series (#2) - Proftpd management and configuration**
https://steemitimages.com/0x0/https://habrastorage.org/getpro/habr/post_images/9e3/d19/948/9e3d19948ac4132613bf784ef7c7d229.png
#### What Will I Learn?
- What is proftpd
- How to install Proftpd
- How to configure Proftpd
- Starting, restarting and stopping the server
- Restrictions about IP and hosts from which you can log in
- Logging in as an anonymous user to the server
- Server load constraints
- Troubleshooting ProFTPD

#### Requirements
- Linux system installed
- Basic knowledge of terminal operation
- Average knowledge of linux commands
- Motivation when something goes wrong

#### Difficulty
Intermediate
<br>
<center>
https://bmat.pl/wp-content/uploads/2015/02/proftpd.jpg
<br>
**Learn Linux Series (#2) - Proftpd management and configuration**
<br>
- **What is proftpd**
<br>
</center>
FTP allows you to transfer files between a server computer and a client computer.

The connection via the FTP protocol can work in two modes:

     active
     passive.

In active mode, FTP uses port 21 for commands and port 20 for data transfer. In passive mode, FTP uses port 21 for commands and a port number above 1024 for data transmission.
<br>
- **Proftpd Installation**
<br>
In the terminal, we must execute the command to download the proftpd software.
To do this, enter the command:
``` language
apt-get install proftpd
```
<br>
if a message pops up that we do not have administrator rights, we must execute the command:
``` language
sudo -s
```
(this command gives us administrator privileges, and keeps them at all times while the terminal is running).
After downloading the software, it's time to launch it.<br>
- **Starting, restarting and stopping the server**<br>
We will need these commands:<br>
Server launch:
``` language
/etc/init.d/proftpd start
```
Message that should appear when the Proftpd server is successfully started:
![poprawny.png](https://res.cloudinary.com/hpiynhbhq/image/upload/v1520510847/taaja3mqmhcfueff2tby.png)

Server restart:
``` language
/etc/init.d/proftpd restart
```
Server stop:
``` language
/etc/init.d/proftpd stop
```
If we already know how to install, run, disable, restart the server, then we have to get to the configuration.
<br>
- **Proftpd configuration**<br>
The basic configuration file is /etc/proftpd.conf<br>
The simplest, enabling the server to work properly, the configuration file is:

``` language
ServerName   "utopian"
ServerAdmin   email@utopian.admin
ServerType   standalone
DefaultServer   on
DefaultRoot   ~
Port    21
Umask    002
User    utopian   
Group    utopian
```
<br>
- **Restrictions about IP and hosts from which you can log in**<br>
Sometimes it happens that we have to set access restrictions to the server.
Limitations can be determined in two ways.
<br>
Method 1:<br>
By default, let everyone in, except for some addresses.<br>
``` language
&lt;Limit LOGIN&gt; 
     Order allow,deny
     Deny from c.utopian.io
     Deny from p.utopian2.io
     &lt;/Limit&gt;
```
Computers from "Deny from" will not be allowed into the server. All others will be let in.
<br>
Method 2:<br>
By default, allow selected people, and the rest do not allow.<br>
``` language
&lt;Limit LOGIN&gt; 
 Order deny,allow
 Allow from c.utopian.io
 &lt;/Limit&gt;
```
Only computers entered in "Allow from" will be allowed to the server.<br>
- **Logging in as an anonymous user to the server**<br>
Anonymous is a special user that have allowed access to public server resources. We can log in without entering the password and freely download the software available.
An example configuration of an anonymous account:
``` language
User    ftp    - user
Group    ftp  - group
AnonRequirePassword          off  - loggining without password
UserAlias   anonymous ftp    - user's aliases
DisplayLogin   .welcome.msg   - welcome message
DisplayFirstChdir  .message  -message that appears after entering the catalog
GroupOwner                    ftp   
Umask                         002     

&lt;Limit  WRITE&gt;     
DenyAll    
&lt;Limit&gt;       

&lt;Limit  READ DIRS&gt;      
IgnoreHidden  on     
&lt;Limit&gt;   
```
<br>
- **Server load constraints**<br>
It happens that the traffic on the server is so big, it overloads the server so much that it can not be operated. In this case, we need to introduce server load constraints. 
We use two commands for this:<br>
``` language
MaxClients
```
and
``` language
MaxClientsPerHost
```
Sample configuration:
``` language
MaxClients 100 "There are currently too many people on the utopian server, try again later!"

MaxClientsPerHost 12 "You have too many open connections, you can not enter to utopian."
```
<br>
- **Troubleshooting ProFTPD**<br>
Error messages can be found in
``` language
/var/log/proftpd/proftpd.log
```
by default, if the Proftpd server does not work after installation, you can check this file.
Sometimes, the server is delayed and you can not access the server. The message "Connection refused" will then pop up. It is not a problem. You must restart the ProFTPD server until it works.
<br>
Default log message if everything is okay:
``` language
2018-03-08 13:04:35,072 vitusc-utopian proftpd[2205] vitusc-utopian: ProFTPD 1.3.5d (maint) (built Thu Ja$
```

#### Curriculum
[Part 1 - TCP/IP Computer Adaptation](https://utopian.io/utopian-io/@vitusc/learn-linux-series-1-tcp-ip-computer-adaptation)
    

<br /><hr/><em>Posted on <a href="https://utopian.io/utopian-io/@vitusc/learn-linux-series-2-proftpd-management-and-configuration">Utopian.io -  Rewarding Open Source Contributors</a></em><hr/>
👍 , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,