ruddystepa
04-07-2007, 13:13
Настраиваю FTP сервер на основе ProFTPd. Сначала он был настроен на чисто анонимный доступ без upload директории. Конфиг такой:
ServerName "My FTP"
ServerType standalone
DefaultServer on
AllowStoreRestart off
Port 21
Umask 022
MaxInstances 30
User nobody
Group nogroup
AllowOverwrite on
<Limit SITE_CHMOD>
DenyAll
</Limit>
PersistentPasswd off
<Anonymous ~ftp>
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 10
# Don't make it require a valid password or shell.
RequireValidShell off
AnonRequirePassword off
# 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 WRITE>
DenyAll
</Limit>
</Anonymous>
Затем, понадобилось сделать доступ в одну из директорий отдельному пользователю, по паролю. Но при этом сохранить анонимный доступ. Почитал документацию, и сделал конфиг для доступа юзера с паролем:
ServerType standalone
DefaultServer on
Umask 022
ServerName "0.0.0.0"
ServerIdent on "My FTPD"
ServerAdmin Admin@this.domain.topdomain
IdentLookups off
UseReverseDNS off
Port 21
PassivePorts 49152 65534
#MasqueradeAddress None
TimesGMT off
MaxInstances 30
MaxLoginAttempts 3
TimeoutLogin 300
TimeoutNoTransfer 120
TimeoutIdle 120
DisplayLogin welcome.msg
DisplayFirstChdir .message
User nobody
Group nobody
DirFakeUser off nobody
DirFakeGroup off nobody
DefaultTransferMode binary
AllowForeignAddress on
AllowRetrieveRestart on
AllowStoreRestart on
DeleteAbortedStores off
TransferRate RETR 30
TransferRate STOR 40
TransferRate STOU 40
TransferRate APPE 40
SystemLog /var/log/secure
RequireValidShell off
#gp_random_username_length 6
#gp_random_password_length 6
#gp_randomize_case lower
#gp_useradd_homedir_path /var/ftp
#gp_useradd_upload_path /upload
#gp_html_path /var/www/html/ftp.htm
#gp_welcome_name welcome.msg
<IfModule mod_tls.c>
TLSEngine off
TLSRequired off
TLSVerifyClient off
TLSProtocol TLSv1
TLSLog /var/log/proftpd_tls.log
TLSRSACertificateFile /etc/gproftpd/gproftpd.pem
</IfModule>
<Limit LOGIN>
AllowUser someuser
DenyALL
</Limit>
<Anonymous /var/ftp/someuser>
User someuser
Group someuser
AnonRequirePassword on
MaxClients 5 "The server is full, hosting %m users"
DisplayLogin welcome.msg
DisplayFirstChdir .msg
<Limit LOGIN>
Allow from all
Deny from all
</Limit>
AllowOverwrite on
<Limit LIST NLST STOR STOU APPE RETR RNFR RNTO DELE MKD XMKD SITE_MKDIR RMD XRMD SITE_RMDIR PWD XPWD SIZE STAT CWD XCWD CDUP XCUP >
AllowAll
</Limit>
<Limit SITE SITE_CHMOD SITE_CHGRP MTDM >
DenyAll
</Limit>
</Anonymous>
А вот как скрестить эти конфиги, чтобы юзер после логина попадал в свою директорию, а анонимы в свою, и файлы друг друга видеть не могли. Пытался я просто добавить конфиг юзера к анониму - любой логин приводит в директорию анонима. В примерах на proftpd.org есть только конфиг для анонимного доступа, или базовый или для виртуальных хостов.
Помогите, пожалуйста, кто знает!
ServerName "My FTP"
ServerType standalone
DefaultServer on
AllowStoreRestart off
Port 21
Umask 022
MaxInstances 30
User nobody
Group nogroup
AllowOverwrite on
<Limit SITE_CHMOD>
DenyAll
</Limit>
PersistentPasswd off
<Anonymous ~ftp>
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 10
# Don't make it require a valid password or shell.
RequireValidShell off
AnonRequirePassword off
# 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 WRITE>
DenyAll
</Limit>
</Anonymous>
Затем, понадобилось сделать доступ в одну из директорий отдельному пользователю, по паролю. Но при этом сохранить анонимный доступ. Почитал документацию, и сделал конфиг для доступа юзера с паролем:
ServerType standalone
DefaultServer on
Umask 022
ServerName "0.0.0.0"
ServerIdent on "My FTPD"
ServerAdmin Admin@this.domain.topdomain
IdentLookups off
UseReverseDNS off
Port 21
PassivePorts 49152 65534
#MasqueradeAddress None
TimesGMT off
MaxInstances 30
MaxLoginAttempts 3
TimeoutLogin 300
TimeoutNoTransfer 120
TimeoutIdle 120
DisplayLogin welcome.msg
DisplayFirstChdir .message
User nobody
Group nobody
DirFakeUser off nobody
DirFakeGroup off nobody
DefaultTransferMode binary
AllowForeignAddress on
AllowRetrieveRestart on
AllowStoreRestart on
DeleteAbortedStores off
TransferRate RETR 30
TransferRate STOR 40
TransferRate STOU 40
TransferRate APPE 40
SystemLog /var/log/secure
RequireValidShell off
#gp_random_username_length 6
#gp_random_password_length 6
#gp_randomize_case lower
#gp_useradd_homedir_path /var/ftp
#gp_useradd_upload_path /upload
#gp_html_path /var/www/html/ftp.htm
#gp_welcome_name welcome.msg
<IfModule mod_tls.c>
TLSEngine off
TLSRequired off
TLSVerifyClient off
TLSProtocol TLSv1
TLSLog /var/log/proftpd_tls.log
TLSRSACertificateFile /etc/gproftpd/gproftpd.pem
</IfModule>
<Limit LOGIN>
AllowUser someuser
DenyALL
</Limit>
<Anonymous /var/ftp/someuser>
User someuser
Group someuser
AnonRequirePassword on
MaxClients 5 "The server is full, hosting %m users"
DisplayLogin welcome.msg
DisplayFirstChdir .msg
<Limit LOGIN>
Allow from all
Deny from all
</Limit>
AllowOverwrite on
<Limit LIST NLST STOR STOU APPE RETR RNFR RNTO DELE MKD XMKD SITE_MKDIR RMD XRMD SITE_RMDIR PWD XPWD SIZE STAT CWD XCWD CDUP XCUP >
AllowAll
</Limit>
<Limit SITE SITE_CHMOD SITE_CHGRP MTDM >
DenyAll
</Limit>
</Anonymous>
А вот как скрестить эти конфиги, чтобы юзер после логина попадал в свою директорию, а анонимы в свою, и файлы друг друга видеть не могли. Пытался я просто добавить конфиг юзера к анониму - любой логин приводит в директорию анонима. В примерах на proftpd.org есть только конфиг для анонимного доступа, или базовый или для виртуальных хостов.
Помогите, пожалуйста, кто знает!