Решил поднять фтп сервер на домашней тачке. Сначала пользовался pure-ftpd, решил теперь перейти на ProFTPd
и тут возникла проблема. Настраивал демон по докам с opennet.ru / unixdoc.ru
и все казалось бы работает. Но НИКАК не хочет пускать на фтп анонимуса (ну т.е. без логина и пароля как в Pure-ftp). При логине anonymous выскакивает ошибка 530 login incorrect
логи пишут
gateway:/etc/proftpd# cat proftpd.conf
#
# /etc/proftpd/proftpd.conf -- This is a basic ProFTPD configuration file.
# To really apply changes reload proftpd after modifications.
#
# Includes DSO modules
Include /etc/proftpd/modules.conf
# Set off to disable IPv6 support which is annoying on IPv4 only boxes.
UseIPv6 off
ServerName "Debian"
ServerType standalone
DeferWelcome off
MultilineRFC2228 on
DefaultServer on
ShowSymlinks on
TimeoutNoTransfer 600
TimeoutStalled 600
TimeoutIdle 1200
DisplayLogin welcome.msg
DisplayFirstChdir .message
ListOptions "-l"
DenyFilter \*.*/
# Port 21 is the standard FTP port.
Port 21
#TransferRate RETR,STOR,APPE 4000 user ftp
AllowStoreRestart on
AllowRetrieveRestart on
#DefaultAddress 89.179.245.70
# In some cases you have to specify passive ports range to by-pass
# firewall limitations. Ephemeral ports can be used for that, but
# feel free to use a more narrow range.
# PassivePorts 49152 65534
# To prevent DoS attacks, set the maximum number of child processes
# to 30. If you need to allow more than 30 concurrent connections
# at once, simply increase this value. Note that this ONLY works
# in standalone mode, in inetd mode you should use an inetd server
# that allows you to limit maximum number of processes per service
# (such as xinetd)
MaxInstances 30
# Set the user and group that the server normally runs at.
User proftpd
Group nogroup
# Umask 022 is a good standard umask to prevent new files and dirs
# (second parm) from being group and world writable.
Umask 022 022
# Normally, we want files to be overwriteable.
AllowOverwrite on
# Uncomment this if you are using NIS or LDAP to retrieve passwords:
# PersistentPasswd off
# Be warned: use of this directive impacts CPU average load!
#
# Uncomment this if you like to see progress and transfer rate with ftpwho
# in downloads. That is not needed for uploads rates.
# UseSendFile off
TransferLog /var/log/proftpd/xferlog
SystemLog /var/log/proftpd/proftpd.log
<IfModule mod_tls.c>
TLSEngine off
</IfModule>
<IfModule mod_quota.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=deta...=LSS-2004-10-02
# It is on by default.
<IfModule mod_delay.c>
DelayEngine on
</IfModule>
<IfModule mod_ctrls.c>
ControlsEngine on
ControlsMaxClients 2
ControlsLog /var/log/proftpd/controls.log
ControlsInterval 5
ControlsSocket /var/run/proftpd/proftpd.sock
</IfModule>
<IfModule mod_ctrls_admin.c>
AdminControlsEngine on
</IfModule>
# A basic anonymous configuration, no upload directories.
DefaultRoot ~ !root
<Anonymous ~ftp>
User ftp
Group nogroup
# We want clients to be able to login with "anonymous" as well as "ftp"
UserAlias anonymous ftp
# Cosmetic changes, all files belongs to ftp user
DirFakeUser on ftp
DirFakeGroup on ftp
RequireValidShell off
# Limit the maximum number of anonymous logins
MaxClients 10
# We want 'welcome.msg' displayed at login, and '.message' displayed
# in each newly chdired directory.
DisplayLogin welcome.msg
DisplayFirstChdir .message
# Limit WRITE everywhere in the anonymous chroot
<Directory *>
<Limit WRITE>
DenyAll
</Limit>
</Directory>
# Uncomment this if you're brave.
# <Directory incoming>
# # Umask 022 is a good standard umask to prevent new files and dirs
# # (second parm) from being group and world writable.
# Umask 022 022
# <Limit READ WRITE>
# DenyAll
# </Limit>
# <Limit STOR>
# AllowAll
# </Limit>
# </Directory>
</Anonymous>
Поставил proftpd из портов под фрю, все заработало. Но потом для удобства решил подключиться к базе MySQL и использовать Proftpd Admin
Все работает, юзеры добавляются, логи просматриваются, но анонимных юзеров хоть убей не пускает.
<Anonymous ~ftp>
AnonRequirePassword off
SQLEngine off
User ftp
Group ftp
### We want clients to be able to login with "anonymous" as well as "ftp"
UserAlias anonymous ftp
### Limit the maximum number of anonymous logins
MaxClients 20
### We want 'welcome.msg' displayed at login, and '.message' displayed
### in each newly chdired directory.
DisplayLogin welcome.msg
# DisplayFirstChdir .message
### Limit WRITE everywhere in the anonymous chroot
<Limit READ>
AllowAll
</Limit>
<Limit WRITE>
DenyAll
</Limit>
</Anonymous>
пробовал создавать юзера anonymous с пустым паролем, тоже не помогает. пришлось создать простые лог и пасс, чтобы люди могли качать файло, но как-то не солидно это
нужен мудрый совет. может кто ставил такую конфигурацию?
ServerName "XXXXXXXXXXXXXXXXXXXXX"
ServerType standalone
ServerIdent on "Servers identifying string"
DeferWelcome on
DefaultServer on
DisplayLogin .welcome # Textfile to display on login
DisplayConnect .connect # Textfile to display on connection
#DisplayFirstChdir .firstchdir # Textfile to display on first changedir
UseReverseDNS off
IdentLookups off
Port 21
Umask 022
MaxInstances 15
MaxClientsPerHost 3 "Only %m connections per host allowed"
MaxClients 10 "Only %m total simultanious logins allowed"
MaxHostsPerUser 20
User ftp
Group ftp
ScoreboardFile /var/run/proftpd/proftpd.scoreboard
# Some logging formats
LogFormat default "%h %l %u %t \"%r\" %s %b"
LogFormat auth "%v [%P] %h %t \"%r\" %s"
LogFormat write "%h %l %u %t \"%r\" %s %b"
# Define log-files to use
TransferLog /var/log/proftpd.xferlog
ExtendedLog /var/log/proftpd.access_log WRITE,READ write
ExtendedLog /var/log/proftpd.auth_log AUTH auth
ExtendedLog /var/log/proftpd.paranoid_log ALL default
SQLLogFile /var/log/proftpd.mysql
# Set up authentication via SQL
# ===========
AuthOrder mod_sql.c
SQLAuthTypes Backend
SQLConnectInfo proftpd_admin@localhost xxxxxxxxx xxxxxxxxxxx
SQLUserInfo usertable userid passwd uid gid homedir shell
SQLGroupInfo grouptable groupname gid members
SQLUserWhereClause "disabled=0 and (NOW()<=expiration or expiration=-1 or expiration=0)"
<IfModule mod_clamav.c> # чЛМАЮБЕН РТПЧЕТЛХ
ClamAV on
</IfModule>
# Log the user logging in
SQLLog PASS counter
SQLNamedQuery counter UPDATE "lastlogin=now(), count=count+1 WHERE userid='%u'" usertable
# logout log
SQLLog EXIT time_logout
SQLNamedQuery time_logout UPDATE "lastlogout=now() WHERE userid='%u'" usertable
# display last login time when PASS command is given
SQLNamedQuery login_time SELECT "lastlogin from usertable where userid='%u'"
SQLShowInfo PASS "230" "Last login was: %{login_time}"
# xfer Log in mysql
SQLLog RETR,STOR transfer1
SQLNamedQuery transfer1 INSERT "'%u', '%f', '%b', '%h', '%a', '%m', '%T', now(), 'c', NULL" xfer_stat
SQLLOG ERR_RETR,ERR_STOR transfer2
SQLNamedQuery transfer2 INSERT "'%u', '%f', '%b', '%h', '%a', '%m', '%T', now(), 'i', NULL" xfer_stat
# <Anonymous ~ftp>
# User ftp
# Group nogroup
# # We want clients to be able to login with "anonymous" as well as "ftp"
# UserAlias anonymous ftp
# SQLEngine off
# AnonRequirePassword off
# # Cosmetic changes, all files belongs to ftp user
# DirFakeUser on ftp
# DirFakeGroup on ftp
# RequireValidShell off
#
# # Limit the maximum number of anonymous logins
# MaxClients 30
#
# # We want 'welcome.msg' displayed at login, and '.message' displayed
# # in each newly chdired directory.
# DisplayLogin welcome.msg
## DisplayFirstChdir .message
#
## Limit WRITE everywhere in the anonymous chroot
#<Directory *>
#<Limit WRITE>
#DenyAll
#</Limit>
#</Directory>
#
## Uncomment this if you're brave.
## <Directory incoming>
## # Umask 022 is a good standard umask to prevent new files and dirs
## # (second parm) from being group and world writable.
## Umask 022 022
## <Limit READ WRITE>
## DenyAll
## </Limit>
## <Limit STOR>
## AllowAll
## </Limit>
## </Directory>
#
#</Anonymous>
<Anonymous ~ftp>
AnonRequirePassword off
SQLEngine off
User ftp
Group ftp
### We want clients to be able to login with "anonymous" as well as "ftp"
UserAlias anonymous ftp
### Limit the maximum number of anonymous logins
MaxClients 20
### We want 'welcome.msg' displayed at login, and '.message' displayed
### in each newly chdired directory.
DisplayLogin welcome.msg
# DisplayFirstChdir .message
### Limit WRITE everywhere in the anonymous chroot
<Limit READ>
AllowAll
</Limit>
<Limit WRITE>
DenyAll
</Limit>
</Anonymous>
AllowStoreRestart on
AllowRetrieveRestart on
RequireValidShell off
PathDenyFilter "\\.ftp)|\\.ht)[a-z]+$"
DefaultRoot ~
#DefaultRoot /mnt/ftp !snark
DenyFilter \*.*/
<Directory /mnt/ftp/*>
AllowOverwrite off
HideNoAccess off
<Limit READ>
AllowAll
</Limit>
<Limit WRITE>
DenyGroup !admins
</Limit>
</Directory>
<Directory /mnt/ftp/pub/upload/*>
AllowOverwrite on
HideNoAccess on
<Limit READ>
AllowAll
</Limit>
<Limit WRITE>
AllowAll
</Limit>
<Limit STOR MKD>
AllowAll
</Limit>
</Directory>
При авторизации используются только те способы, которые указаны в AuthOrder. В AuthOrder стоит только mod_sql, соответственно, вся авторизация идёт через mod_sql БЕЗ попыток авторизации в системном /etc/passwd.
При авторизации используются только те способы, которые указаны в AuthOrder. В AuthOrder стоит только mod_sql, соответственно, вся авторизация идёт через mod_sql БЕЗ попыток авторизации в системном /etc/passwd.
а мне не нужна авторизация через /etc/passwd. я хочу как-то прикрутить анонимного пользователя, который прописан в конфиге. какая из авторизаций AuthOrder отвечает за конфиг?