Portál AbcLinuxu, 6. listopadu 2025 17:57
Include /etc/proftpd/modules.conf
UseIPv6 off
AuthOrder mod_sql.c
# If set on you can experience a longer connection delay in many cases.
IdentLookups off
ServerName "FTP"
ServerType standalone
DeferWelcome off
MultilineRFC2228 on
DefaultServer on
ShowSymlinks on
TimeoutNoTransfer 1800
TimeoutStalled 1800
TimeoutIdle 2400
#DisplayLogin welcome.msg
#DisplayChdir .message true
#ListOptions "-l"
# DenyFilter \*.*/
# Use this to jail all users in their homes
DefaultRoot ~
# Port 21 is the standard FTP port.
Port 21
DefaultTransferMode ascii
Global
PassivePorts 60000 61000
/Global
MaxInstances 60
# Set the user and group that the server normally runs at.
User www-data
Group ftpgroup
# Umask 022 is a good standard umask to prevent new files and dirs
# (second parm) from being group and world writable.
Umask 002 002
# Normally, we want files to be overwriteable.
AllowOverwrite on
# Uncomment this if you are using NIS or LDAP via NSS to retrieve passwords:
PersistentPasswd off
TransferLog /var/log/proftpd/xferlog
SystemLog /var/log/proftpd/proftpd.log
IfModule mod_quotatab.c>
QuotaEngine on
/IfModule>
IfModule mod_ratio.c>
Ratios on
/IfModule>
# Delay engine reduces impact of the so-called Timing Attack described in
# http://security.lss.hr/index.php?page=details&ID=LSS-2004-10-02
# It is on by default.
IfModule mod_delay.c>
DelayEngine on
/IfModule>
IfModule mod_ctrls.c>
ControlsEngine off
ControlsMaxClients 2
ControlsLog /var/log/proftpd/controls.log
ControlsInterval 5
ControlsSocket /var/run/proftpd/proftpd.sock
/IfModule>
IfModule mod_ctrls_admin.c>
AdminControlsEngine off
/IfModule>
Ifmodule mod_sql.c>
#
# Proftpd sample configuration for SQL-based authentication.
#
# (This is not to be used if you prefer a PAM-based SQL authentication)
#
SQLBackend mysql
# The passwords in MySQL are encrypted using CRYPT
SQLAuthTypes Plaintext crypt
SQLAuthenticate users groups
# used to connect to the database
# databasename@host database_user user_password
SQLConnectInfo ftp@localhost proftpd "vysoce rafinovane heslo"
# Here we tell ProFTPd the names of the database columns in the "usertable"
# we want it to interact with. Match the names with those in the db
SQLUserInfo ftpuser userid passwd uid gid homedir shell
# Here we tell ProFTPd the names of the database columns in the "grouptable"
# we want it to interact with. Again the names match with those in the db
SQLGroupInfo ftpgroup groupname gid members
# set min UID and GID - otherwise these are 999 each
SQLMinID 500
# create a user's home directory on demand if it doesn't exist
CreateHome on
# Update count every time user logs in
SQLLog PASS updatecount
SQLNamedQuery updatecount UPDATE "count=count+1, accessed=now() WHERE userid='%u'" ftpuser
# Update modified everytime user uploads or deletes a file
SQLLog STOR,DELE modified
SQLNamedQuery modified UPDATE "modified=now() WHERE userid='%u'" ftpuser
# User quotas
# ===========
QuotaEngine on
QuotaDirectoryTally on
QuotaDisplayUnits Mb
QuotaShowQuotas on
SQLNamedQuery get-quota-limit SELECT "name, quota_type, per_session, limit_type, bytes_in_avail, bytes_out_avail, bytes_xfer_avail, files_in_avail, files_out_avail, files_xfer_$
SQLNamedQuery get-quota-tally SELECT "name, quota_type, bytes_in_used, bytes_out_used, bytes_xfer_used, files_in_used, files_out_used, files_xfer_used FROM ftpquotatallies WHER$
SQLNamedQuery update-quota-tally UPDATE "bytes_in_used = bytes_in_used + %{0}, bytes_out_used = bytes_out_used + %{1}, bytes_xfer_used = bytes_xfer_used + %{2}, files_in_used =$
SQLNamedQuery insert-quota-tally INSERT "%{0}, %{1}, %{2}, %{3}, %{4}, %{5}, %{6}, %{7}" ftpquotatallies
QuotaLimitTable sql:/get-quota-limit
QuotaTallyTable sql:/get-quota-tally/update-quota-tally/insert-quota-tally
RootLogin off
RequireValidShell off
/IfModule
cat /etc/proftpd/proftpd.conf
ServerName "ProFTPD"
ServerType standalone
ServerIdent on "Welcome to the FTP server. Please login..."
ServerAdmin president@whitehouse.gov
DeferWelcome on
DefaultServer on
DefaultRoot ~
RequireValidShell off
RootLogin off
AuthPAM off
AuthPAMConfig ftp
Port 21
Umask 022 022
MaxInstances 50
User nobody
Group nogroup
AllowOverwrite on
AllowForeignAddress off # kvuli povoleni server-server stahovani musi byt on
AllowRetrieveRestart on # resume download
AllowStoreRestart on # resume upload
#DebugLevel 5
PassivePorts 49152 65534
ShowSymlinks on
TimeoutNoTransfer 600
TimeoutStalled 600
TimeoutIdle 1200
ListOptions "-|"
DenyFilter \*.*/
SQLMinID 20
SQLConnectInfo login@server:3306 pass LULH45aYExb7Gztu
SQLAuthTypes Crypt
SQLUserInfo users userid password uid gid homedir shell
SQLGroupInfo groups groupname gid members
SQLAuthenticate users* groups*
SQLLogFile /var/log/proftpd.sql.log
AuthOrder mod_sql.c
SQLLog PASS updatecount
SQLNamedQuery updatecount UPDATE "count=count+1, accessed=now() WHERE userid='%u'" users
SQLLog STOR,DELE modified
SQLNamedQuery modified UPDATE "modified=now() WHERE userid='%u'" users
# User quotas
# ===========
QuotaEngine on
QuotaDirectoryTally on
QuotaDisplayUnits Mb
QuotaShowQuotas on
SQLNamedQuery get-quota-limit SELECT "userid, quota_type, per_session, \
limit_type, bytes_in_avail, bytes_out_avail,bytes_xfer_avail, files_in_avail, \
files_out_avail, files_xfer_avail FROM users WHERE userid = '%{0}' AND \
quota_type = '%{1}'"
SQLNamedQuery get-quota-tally SELECT "userid, quota_type, bytes_in_used, \
bytes_out_used, bytes_xfer_used, files_in_used, files_out_used, files_xfer_used \
FROM quotatallies WHERE userid = '%{0}' AND quota_type = '%{1}'"
SQLNamedQuery update-quota-tally UPDATE "bytes_in_used = bytes_in_used + %{0}, \
bytes_out_used = bytes_out_used + %{1}, bytes_xfer_used = bytes_xfer_used + %{2}, \
files_in_used = files_in_used + %{3}, files_out_used = files_out_used + %{4}, \
files_xfer_used = files_xfer_used + %{5} WHERE userid = '%{6}' AND quota_type = '%{7}'" quotatallies
SQLNamedQuery insert-quota-tally INSERT "%{0}, %{1}, '%{2}', '%{3}', '%{4}', '%{5}', '%{6}', '%{7}'" quotatallies
QuotaLimitTable sql:/get-quota-limit
QuotaTallyTable sql:/get-quota-tally/update-quota-tally/insert-quota-tally
# Banner
SQLNamedQuery gettally SELECT "ROUND((bytes_in_used/1048576),2) FROM quotatallies WHERE userid='%u'"
SQLNamedQuery getlimit SELECT "ROUND((bytes_in_avail/1048576),2) FROM users WHERE userid='%u'"
SQLNamedQuery getfree SELECT "ROUND(((users.bytes_in_avail-quotatallies.bytes_in_used)/1048576),2) FROM users,quotatallies WHERE users.userid = '%u' AND quotatallies.userid = '%u'"
SQLShowInfo LIST "226" "Used %{gettally}MB from %{getlimit}MB. You have %{getfree}MB available space."
<Directory /var/ftp/_upload/*>
<Limit WRITE STOR MKD XMKD>
AllowALL
</Limit>
<Limit READ RMD XRMD DELE>
DenyAll
</Limit>
</Directory>
Tiskni
Sdílej:
ISSN 1214-1267, (c) 1999-2007 Stickfish s.r.o.