ftp (server closed connection)

Обсуждение настройки и работы сервисов, резервирования, сетевых настроек и вопросов безопасности ОС.

Модераторы: SLEDopit, Модераторы разделов

ska
Сообщения: 202
ОС: ALTLinux School Master

ftp

Сообщение ska »

На компе с запущенным фтп (vsftpd) создал локальный репозитарий и поместил его в /var/ftp/Repositary/
конфиг фтп такой

Код: Выделить всё

service ftp
{
        disable         = no
        only_from       = 192.168.0.0
        socket_type     = stream
        protocol        = tcp
        wait            = no
        user            = root
        nice            = 10
        rlimit_as       = 200M
        server          = /usr/sbin/vsftpd
#       server_args     =
}

Перехожу на клиентский комп, отмечаю на нем в качестве репозитариев rpm и src-rpm
ftp://192.168.0.6/Repositary/
Кликаю получить сведения о пакетах, получаю
ftp://192.168.0.6/Repositary/i586/base/pkglist.myrep: Server closed connection
ftp://192.168.0.6/Repositary/i586/base/srclist.myrep: Server closed connection
ftp://192.168.0.6/Repositary/i586/base/release.myrep: Server closed connection
Спасибо сказали:
Аватара пользователя
/dev/random
Администратор
Сообщения: 5495
ОС: Gentoo

Re: ftp

Сообщение /dev/random »

ska писал(а):
17.03.2011 10:04
конфиг фтп такой

1) Я так полагаю, что всё-таки это не конфиг ftp, а конфиг xinetd.

ska писал(а):
17.03.2011 10:04
Кликаю получить сведения о пакетах, получаю
ftp://192.168.0.6/Repositary/i586/base/pkglist.myrep: Server closed connection
ftp://192.168.0.6/Repositary/i586/base/srclist.myrep: Server closed connection
ftp://192.168.0.6/Repositary/i586/base/release.myrep: Server closed connection

2) При ручном доступе к этим файлам что получается?

3) Выложите всё-таки конфиг vsftpd. И в логах посмотрите, что происходит.

iУведомление от модератора
4) Перемещаю тему из "программ" в "администрирование".
Спасибо сказали:
ska
Сообщения: 202
ОС: ALTLinux School Master

Re: ftp

Сообщение ska »

/dev/random писал(а):
17.03.2011 10:19
2) При ручном доступе к этим файлам что получается?

Все получается - захожу через браузер, могу смотреть могу сохранять в домашнюю папку.

/dev/random писал(а):
17.03.2011 10:19
3) Выложите всё-таки конфиг vsftpd. И в логах посмотрите, что происходит.

Он умалчальный - ничего там не менял

Код: Выделить всё

# cat /etc/vsftpd.conf
# The configuration file for vsftpd.
#
# The default compiled in settings are fairly paranoid. This sample file
# loosens things up a bit, to make the ftp daemon more usable.
# Please see vsftpd.conf(5) for all compiled in defaults.
#
# READ THIS: This example file is NOT an exhaustive list of vsftpd options.
# Please read the vsftpd.conf(5) manual page to get a full idea of vsftpd's
# capabilities.
#
# Uncomment this to disallow the PORT method of obtaining a data connection.
#port_enable=NO
#
# Uncomment this to disallow the PASV method of obtaining a data connection.
#pasv_enable=NO
#
# Allow anonymous FTP? (Beware - allowed by default if you comment this out).
# You might want to install anonftp to provide /var/ftp and ftpadmin group.
anonymous_enable=YES
#
# Uncomment this to allow local users to log in.
#local_enable=YES
#
# Uncomment this to enable any form of FTP write command.
#write_enable=YES
#
# Default umask for local users is 077. You may wish to change this to 022,
# if your users expect that (022 is used by most other ftpd's)
#local_umask=022
#
# The minimum port to allocate for PASV style data connections.
# Can be used to specify a narrow port range to assist firewalling.
# The default is shown below.
#pasv_min_port=49152
#
# The maximum port to allocate for PASV style data connections.
# Can be used to specify a narrow port range to assist firewalling.
# The default is shown below.
#pasv_max_port=65535
#
# Uncomment this to allow the anonymous FTP user to upload files. This only
# has an effect if the above global write enable is activated. Also, you will
# obviously need to create a directory writable by the FTP user.
#anon_upload_enable=YES
#
# Uncomment this if you want the anonymous FTP user to be able to create
# new directories.
#anon_mkdir_write_enable=YES
#
# Activate directory messages - messages given to remote users when they
# go into a certain directory.
dirmessage_enable=YES
#
# Activate logging of uploads/downloads.
xferlog_enable=YES
#
# Make sure PORT transfer connections originate from port 20 (ftp-data).
connect_from_port_20=YES
#
# If you want, you can arrange for uploaded anonymous files to be owned by
# a different user. Note! Using "root" for uploaded files is not
# recommended!
#chown_uploads=YES
#chown_username=whoever
#
# You may override where the log file goes if you like. The default is shown
# below.
#xferlog_file=/var/log/vsftpd.log
#
# If you want, you can have your log file in standard ftpd xferlog format.
# Note that the default log file location is /var/log/xferlog in this case.
#xferlog_std_format=YES
#
# You may change the default value for timing out an idle session.
#idle_session_timeout=600
#
# You may change the default value for timing out a data connection.
#data_connection_timeout=120
#
# It is recommended that you define on your system a unique user which the
# ftp server can use as a totally isolated and unprivileged user.
#nopriv_user=novsftpd
#
# Enable this and the server will recognise asynchronous ABOR requests. Not
# recommended for security (the code is non-trivial). Not enabling it,
# however, may confuse older FTP clients.
#async_abor_enable=YES
#
# By default the server will pretend to allow ASCII mode but in fact ignore
# the request. Turn on the below options to have the server actually do ASCII
# mangling on files when in ASCII mode.
# Beware that on some FTP servers, ASCII support allows a denial of service
# attack (DoS) via the command "SIZE /big/file" in ASCII mode. vsftpd
# predicted this attack and has always been safe, reporting the size of the
# raw file.
# ASCII mangling is a horrible feature of the protocol.
#ascii_upload_enable=YES
#ascii_download_enable=YES
#
# You may fully customise the login banner string:
#ftpd_banner=Welcome to blah FTP service.
#
# You may specify a file of disallowed anonymous e-mail addresses. Apparently
# useful for combatting certain DoS attacks.
#deny_email_enable=YES
# (default follows)
#banned_email_file=/etc/vsftpd/banned_emails
#
# If enabled, local users will be (by default) placed in a chroot() jail
# in their home directory after login.
# Warning: this option has non-trivial security implications, especially
# if the users also have shell access. Only enable if you know what you are
# doing (and you probably don't).
#chroot_local_user=YES
#
# You may specify an explicit list of local users to chroot() to their home
# directory. If chroot_local_user is YES, then this list becomes a list of
# users to NOT chroot().
# Warning: these features have non-trivial security implications, especially
# if the users also have shell access. Only enable if you know what you are
# doing (and you probably don't).
#chroot_list_enable=YES
# (default follows)
#chroot_list_file=/etc/vsftpd/chroot_list
#
# You may activate the "-R" option to the builtin ls. This is disabled by
# default to avoid remote users being able to cause excessive I/O on large
# sites. However, some broken FTP clients such as "ncftp" and "mirror" assume
# the presence of the "-R" option, so there is a strong case for enabling it.
#ls_recurse_enable=YES
#
# If enabled, all user and group information in directory listings will be
# displayed as "ftp".
# The default is to hide user and group information.
#hide_ids=YES
#
# If enabled, vsftpd will display directory listings with the time in your
# local time zone. The default is to display GMT. The times returned by the
# MDTM FTP command are also affected by this option.
#use_localtime=YES
#
# When "listen" directive is enabled, vsftpd runs in standalone mode and
# listens on IPv4 sockets. This directive cannot be used in conjunction
# with the listen_ipv6 directive.
#listen=YES
#
# This directive enables listening on IPv6 sockets. To listen on IPv4 and IPv6
# sockets, you must run two copies of vsftpd with two configuration files.
# Make sure, that one of the listen options is commented !!
#listen_ipv6=YES

Логи пустые

Код: Выделить всё

# ls -l /var/log/ftp
total 0
-rw-r----- 1 root adm 0 Dec 22 17:26 errors
-rw-r----- 1 root adm 0 Dec 22 17:26 info
-rw-r----- 1 root adm 0 Dec 22 17:26 warnings
Спасибо сказали:
ska
Сообщения: 202
ОС: ALTLinux School Master

Re: ftp

Сообщение ska »

Server said 'Failed to open file' и еще вот это

Код: Выделить всё

# cat /var/log/vsftpd.log
Wed Mar 16 16:09:50 2011 [pid 27640] CONNECT: Client "192.168.0.30"
Wed Mar 16 16:09:50 2011 [pid 27639] [vsftpd] OK LOGIN: Client "192.168.0.30", anon password "mozilla@example.com"
Thu Mar 17 16:41:44 2011 [pid 31228] CONNECT: Client "192.168.0.30"
Thu Mar 17 16:41:44 2011 [pid 31227] [vsftpd] OK LOGIN: Client "192.168.0.30", anon password "mozilla@example.com"
Thu Mar 17 16:41:52 2011 [pid 31229] [vsftpd] OK DOWNLOAD: Client "192.168.0.30", "/Repositary/i586/base/pkglist.myrep", 148124 bytes, 961.32Kbyte/sec
Thu Mar 17 17:23:14 2011 [pid 32725] CONNECT: Client "192.168.0.30"
Thu Mar 17 17:23:14 2011 [pid 32724] [vsftpd] OK LOGIN: Client "192.168.0.30", anon password "apt_get_ftp_2.1@alt.linux.user"
Thu Mar 17 17:23:14 2011 [pid 32726] [vsftpd] FAIL DOWNLOAD: Client "192.168.0.30", "/Repositary/i586/base/release", 0.00Kbyte/sec
Thu Mar 17 17:23:15 2011 [pid 32728] CONNECT: Client "192.168.0.30"
Thu Mar 17 17:23:15 2011 [pid 32727] [vsftpd] OK LOGIN: Client "192.168.0.30", anon password "apt_get_ftp_2.1@alt.linux.user"
Thu Mar 17 17:23:15 2011 [pid 32729] [vsftpd] FAIL DOWNLOAD: Client "192.168.0.30", "/Repositary/i586/base/pkglist.myrep.bz2", 0.00Kbyte/sec
Thu Mar 17 17:23:15 2011 [pid 32729] [vsftpd] FAIL DOWNLOAD: Client "192.168.0.30", "/Repositary/i586/base/release.myrep", 0.00Kbyte/sec
Thu Mar 17 17:23:15 2011 [pid 32729] [vsftpd] FAIL DOWNLOAD: Client "192.168.0.30", "/Repositary/i586/base/srclist.myrep.bz2", 0.00Kbyte/sec
Thu Mar 17 17:45:11 2011 [pid 1081] CONNECT: Client "192.168.0.30"
Thu Mar 17 17:45:11 2011 [pid 1080] [vsftpd] OK LOGIN: Client "192.168.0.30", anon password "apt_get_ftp_2.1@alt.linux.user"
Thu Mar 17 17:45:11 2011 [pid 1082] [vsftpd] FAIL DOWNLOAD: Client "192.168.0.30", "/Repositary/i586/base/release", 0.00Kbyte/sec
Thu Mar 17 17:45:11 2011 [pid 1084] CONNECT: Client "192.168.0.30"
Thu Mar 17 17:45:11 2011 [pid 1083] [vsftpd] OK LOGIN: Client "192.168.0.30", anon password "apt_get_ftp_2.1@alt.linux.user"
Thu Mar 17 17:45:11 2011 [pid 1085] [vsftpd] FAIL DOWNLOAD: Client "192.168.0.30", "/Repositary/i586/base/pkglist.myrep.bz2", 0.00Kbyte/sec
Thu Mar 17 17:45:11 2011 [pid 1085] [vsftpd] FAIL DOWNLOAD: Client "192.168.0.30", "/Repositary/i586/base/release.myrep", 0.00Kbyte/sec
Thu Mar 17 17:45:11 2011 [pid 1085] [vsftpd] FAIL DOWNLOAD: Client "192.168.0.30", "/Repositary/i586/base/srclist.myrep.bz2", 0.00Kbyte/sec
Thu Mar 17 17:47:21 2011 [pid 1161] CONNECT: Client "192.168.0.30"
Thu Mar 17 17:47:21 2011 [pid 1160] [vsftpd] OK LOGIN: Client "192.168.0.30", anon password "apt_get_ftp_2.1@alt.linux.user"
Thu Mar 17 17:47:22 2011 [pid 1162] [vsftpd] FAIL DOWNLOAD: Client "192.168.0.30", "/Repositary/i586/base/release", 0.00Kbyte/sec
Thu Mar 17 17:47:22 2011 [pid 1164] CONNECT: Client "192.168.0.30"
Thu Mar 17 17:47:22 2011 [pid 1163] [vsftpd] OK LOGIN: Client "192.168.0.30", anon password "apt_get_ftp_2.1@alt.linux.user"
Thu Mar 17 17:47:22 2011 [pid 1165] [vsftpd] FAIL DOWNLOAD: Client "192.168.0.30", "/Repositary/i586/base/pkglist.myrep.bz2", 0.00Kbyte/sec
Thu Mar 17 17:47:22 2011 [pid 1165] [vsftpd] FAIL DOWNLOAD: Client "192.168.0.30", "/Repositary/i586/base/release.myrep", 0.00Kbyte/sec
Thu Mar 17 17:47:22 2011 [pid 1165] [vsftpd] FAIL DOWNLOAD: Client "192.168.0.30", "/Repositary/i586/base/srclist.myrep.bz2", 0.00Kbyte/sec
Thu Mar 17 17:54:08 2011 [pid 1415] CONNECT: Client "192.168.0.30"
Thu Mar 17 17:54:08 2011 [pid 1414] [vsftpd] OK LOGIN: Client "192.168.0.30", anon password "apt_get_ftp_2.1@alt.linux.user"
Thu Mar 17 17:54:08 2011 [pid 1416] [vsftpd] FAIL DOWNLOAD: Client "192.168.0.30", "/Repositary/i586/base/release", 0.00Kbyte/sec
Thu Mar 17 17:54:08 2011 [pid 1418] CONNECT: Client "192.168.0.30"
Thu Mar 17 17:54:08 2011 [pid 1417] [vsftpd] OK LOGIN: Client "192.168.0.30", anon password "apt_get_ftp_2.1@alt.linux.user"
Thu Mar 17 17:54:08 2011 [pid 1419] [vsftpd] FAIL DOWNLOAD: Client "192.168.0.30", "/Repositary/i586/base/pkglist.myrep.bz2", 0.00Kbyte/sec
Thu Mar 17 17:54:08 2011 [pid 1419] [vsftpd] FAIL DOWNLOAD: Client "192.168.0.30", "/Repositary/i586/base/release.myrep", 0.00Kbyte/sec
Thu Mar 17 17:54:08 2011 [pid 1419] [vsftpd] FAIL DOWNLOAD: Client "192.168.0.30", "/Repositary/i586/base/srclist.myrep.bz2", 0.00Kbyte/sec
Спасибо сказали:
ska
Сообщения: 202
ОС: ALTLinux School Master

Re: ftp

Сообщение ska »

/dev/random писал(а):
17.03.2011 10:19
2) При ручном доступе к этим файлам что получается?

Пардон, сохранять эти файлы через браузер не получается - Загрузка не может быть сохранена, так как произошла неизвестная ошибка))
Спасибо сказали:
Аватара пользователя
drBatty
Сообщения: 8735
Статус: GPG ID: 4DFBD1D6 дом горит, козёл не видит...
ОС: Slackware-current

Re: ftp

Сообщение drBatty »

ska писал(а):
18.03.2011 13:58
Пардон, сохранять эти файлы через браузер не получается - Загрузка не может быть сохранена, так как произошла неизвестная ошибка))

ручной доступ это как-то так man ftp
http://emulek.blogspot.ru/ Windows Must Die
Учебник по sed зеркало в github

Скоро придёт
Осень
Спасибо сказали:
Аватара пользователя
lastpriot
Сообщения: 218
ОС: FreeBSD

Re: ftp

Сообщение lastpriot »

Thu Mar 17 17:45:11 2011 [pid 1083] [vsftpd] OK LOGIN: Client "192.168.0.30", anon password "apt_get_ftp_2.1@alt.linux.user"

указывает на то, что у вас гостевой доступ

vsftpd "изкоропки" не работает так, как надо
вот пример рабочего конфига с сервера (FreeBSD), перепишите под себя

Код: Выделить всё

# Standalone mode
listen=YES
listen_address=192.168.10.105

background=YES

max_clients=15
max_per_ip=5

# Access rights
anonymous_enable=YES
no_anon_password=YES

anon_upload_enable=NO
anon_mkdir_write_enable=NO
anon_other_write_enable=NO

anon_root=/var/ftp/

local_enable=YES
write_enable=YES

local_umask=022
anon_umask=022

dirmessage_enable=YES

nopriv_user=ftpsecure

chroot_local_user=YES
chroot_list_enable=YES
chroot_list_file=/etc/ftp_chroot_list

# Security
pasv_enable=YES
pasv_min_port=50000
pasv_max_port=60000

delay_failed_login=1
delay_successful_login=0

secure_chroot_dir=/usr/local/share/empty
connect_from_port_20=YES

# Features
xferlog_enable=YES
xferlog_file=/var/log/vsftpd.log
log_ftp_protocol=NO

# Performance
idle_session_timeout=120
data_connection_timeout=300
accept_timeout=60
connect_timeout=60

# Tuning
anon_max_rate=4500000
local_max_rate=500000
trans_chunk_size=8192

delete_failed_uploads=YES
Спасибо сказали:
ska
Сообщения: 202
ОС: ALTLinux School Master

Re: ftp

Сообщение ska »

drBatty писал(а):
18.03.2011 15:10
ska писал(а):
18.03.2011 13:58
Пардон, сохранять эти файлы через браузер не получается - Загрузка не может быть сохранена, так как произошла неизвестная ошибка))

ручной доступ это как-то так man ftp

Код: Выделить всё

$ man ftp
No manual entry for ftp

Ну сказали бы тогда уж сами, что следует считать ручным доступом к этим файлам.
Спасибо сказали:
ska
Сообщения: 202
ОС: ALTLinux School Master

Re: ftp

Сообщение ska »

Код: Выделить всё

# cat /etc/vsftpd.conf
# The configuration file for vsftpd.
#
anonymous_enable=YES
no_anon_password=YES
anon_upload_enable=NO
anon_mkdir_write_enable=NO
anon_other_write_enable=NO
anon_root=/var/ftp/

#
local_enable=YES
#
write_enable=YES
#
local_umask=022
anon_umask=022
#
dirmessage_enable=YES
#
xferlog_enable=YES
#
connect_from_port_20=YES
#
nopriv_user=novsftpd
#
listen=YES
listen_address=192.168.0.6
background=YES
idle_session_timeout=120
data_connection_timeout=300
accept_timeout=60
connect_timeout=60
#
anon_max_rate=4500000
local_max_rate=500000
trans_chunk_size=8192
#
delete_failed_uploads=YES

Все равно ошибка - Server closed connection
Спасибо сказали:
ska
Сообщения: 202
ОС: ALTLinux School Master

Re: ftp

Сообщение ska »

В структуре моего локального репозитаря имелись символьные ссылки. Говорят, что
vsftpd работает в chroot-е и по симлинкам не пускает.

После того, как убрал ссылки, все заработало
Спасибо сказали:
Аватара пользователя
drBatty
Сообщения: 8735
Статус: GPG ID: 4DFBD1D6 дом горит, козёл не видит...
ОС: Slackware-current

Re: ftp

Сообщение drBatty »

ska писал(а):
19.03.2011 06:42
Ну сказали бы тогда уж сами, что следует считать ручным доступом к этим файлам.

ftp - это не только название протокола, но и команда ака программа. Я думал она есть во всех версиях Windows & Linux. Выходит - у вас нету. Извините, не знал. man -k ftp выручает в таких случаях.
ska писал(а):
19.03.2011 09:16
vsftpd работает в chroot-е и по симлинкам не пускает.

пускает он по симлинкам. Просто симлинки должны быть внутри этого chroot'а. Можно использовать mount --bind, если вы не хотите копировать (при этом конечно права должны быть readonly, а то смысла в chroot'е нет).
http://emulek.blogspot.ru/ Windows Must Die
Учебник по sed зеркало в github

Скоро придёт
Осень
Спасибо сказали:
ska
Сообщения: 202
ОС: ALTLinux School Master

Re: ftp

Сообщение ska »

drBatty писал(а):
20.03.2011 13:15
пускает он по симлинкам. Просто симлинки должны быть внутри этого chroot'а. Можно использовать mount --bind, если вы не хотите копировать (при этом конечно права должны быть readonly, а то смысла в chroot'е нет).

Код: Выделить всё

# ls -l /var/ftp/Repositary/i586/
total 16
drwxr-sr-x 2 root ftpadmin 4096 Mar 22 19:58 RPMS
drwxr-sr-x 2 root ftpadmin 4096 Mar 19 15:44 RPMS.myrep
drwxr-sr-x 2 root ftpadmin 4096 Mar 19 15:40 SRPMS.myrep
drwxr-sr-x 2 root ftpadmin 4096 Mar 22 10:51 base

т.е. мои симлинки в данном случае за пределами chroot?
Спасибо сказали: