====== FTP: vsftpd, установка и настройка ====== * [[https://www.bfccomputing.com/howto/internet/linux/networking/open%20source/sysadmin/unix/2012/11/27/vsftpd-configuration-for-tls-and-passive-mode.html|vsftpd Configuration for TLS and Passive Mode]] * [[https://www.dmosk.ru/instruktions.php?object=vsftpd-centos|Настройка FTP-сервера vsFTPd на CentOS 7]] * www.krizna.com/centos/setup-ftp-server-centos-7-vsftp/ * https://github.com/serghey-rodin/vesta/blob/master/bin/v-add-web-domain-ftp * [[http://blog.oneiroi.co.uk/linux/security/vsftpd-chrooting-without-the-headache-allowing-shared-directories/|Vsftpd Chrooting Without the Headache, Allowing Shared Directories]] * [[http://nuxref.com/2014/01/09/configuring-and-installing-vsftpd-on-centos-6/|Configuring and Installing VSFTPD on CentOS 6]] ==== Отдельный конфиг для юзера ==== ''vsftpd.conf'' user_config_dir = /etc/vsftpd/userconf'' ''/etc/vsftpd/userconf/john'' ==== Анонимные пользователи не могут переименовывать файлы ==== При попытке переименовать директорию или файл выдаётся ошибка "550 Permission Denied" Добавляем опцию ''anon_other_write_enable'' If set to YES, anonymous users will be permitted to perform write operations other than upload and create directory, such as deletion and renaming. This is generally not recommended but included for completeness. Default: NO ==== 425 Use PORT or PASV first. ==== The FTP server wants to know whether to use a port-mode channel or passive-mode data channel. Most clients will set this up for you transparently (and generally choose passive 'cos it's newer and better). To send a command to the server you use the 'quote' command. Hence if you type: quote PASV then it should all work nicely. As an aside, if you type 'remotehelp' then it should show you all the commands that the server can receive - all these can be used with the 'quote' command. Исходные данные CentOS 6, vsftpd http://wiki.autosys.tk/doku.php?id=linux_faq:vsftpd-%D0%B8-%D0%B2%D0%B8%D1%80%D1%82%D1%83%D0%B0%D0%BB%D1%8C%D0%BD%D1%8B%D0%B5-%D0%BF%D0%BE%D0%BB%D1%8C%D0%B7%D0%BE%D0%B2%D0%B0%D1%82%D0%B5%D0%BB%D0%B8-virtual-users-on-debian [[http://crunchtools.com/vsftpd-ssl/|Securing FTP with VSFTPD and SSL]] ===== Конфигурационный файл vsftpd (описание опций) ===== ^ Опция ^ Значение по-умолчанию ^ Описание опции ^ http://www.davekb.com/browse_computer_tips:vsftpd_xferlog_format:txt ===== Установка vsftpd ===== yum install vsftpd chkconfig vsftpd on https://wiki.debian.org/ru/vsftpd/EXAMPLE/VIRTUAL_USERS anonymous_enable=NO # запретить вход анонимным пользователям local_enable=YES # разрешить доступ локальным учетным записям write_enable=YES # разрешить запись ftpd_banner=Battlecruiser operational # сообщение, которое выводится при коннекте ===== Сценарий #1 Локальные пользователи ===== 1 ===== Сценарий #2 Виртуальные пользователи ===== 1 ===== Усложняем настройку. SSL ===== ===== Настройка iptables для vsftpd ===== # iptables -I INPUT -m state --state NEW -m tcp -p tcp --dport 20 -j ACCEPT # iptables -I INPUT -m state --state NEW -m tcp -p tcp --dport 21 -j ACCEPT * http://dunmaksim.blogspot.ru/2013/04/vsftpd-centos.html * http://magnus-k-karlsson.blogspot.ru/2014/08/rhel-6-ftp-configure-anonymous-only.html * https://www.linux.org.ru/news/opensource/11805321/page1?lastmod=1438198063515#comment-11814461 * [[http://www.binarytides.com/vsftpd-configure-ssl-ftps/|How to configure vsftpd to use SSL/TLS (FTPS) on CentOS/Ubuntu]] * [[http://eax.me/ftp-descr/|Описание протокола FTP + примеры]] * http://interface31.ru/tech_it/2016/01/nastraivaem-ftp-server-s-virtual-nymi-pol-zovatelyami-na-baze-vsftpd.html * https://wiki.centos.org/HowTos/Chroot_Vsftpd_with_non-system_users [[http://vps.ua/wiki/%D0%9A%D0%BE%D0%BD%D1%84%D0%B8%D0%B3%D1%83%D1%80%D0%B0%D1%86%D0%B8%D0%BE%D0%BD%D0%BD%D1%8B%D0%B9_%D1%84%D0%B0%D0%B9%D0%BB_vsftpd|Конфигурационный файл vsftpd]] [[http://www.shellhacks.com/ru/Ustanovka-VSftpd-FTP-Servera-na-CentOS-RHEL|Установка VSftpd FTP Сервера на CentOS/RHEL]] ==== запретить определённые ftp-директивы для юзера ==== via http://xsektorx.org/vsftpd vsftpd.conf user_config_dir=/etc/vsftpd/users /etc/vsftpd/users/username cmds_allowed=CDUP,CWD,FEAT,HELP,LIST,MDTM,MLSD,MLST,NLST,NOOP,PASS,PASV,PWD,QUIT,SIZE,STAT,USER,XCUP ===== Ошибки и их решение ===== ==== 500 OOPS: child died ==== seccomp_sandbox=NO in vsftpd.conf http://serverfault.com/questions/574722/vsftp-error-500-oops-child-died ==== 500 OOPS: priv_sock_get_cmd ==== Добавить в конфиг seccomp_sandbox=NO via https://bugzilla.redhat.com/show_bug.cgi?id=845980 ==== 500 Illegal PORT command ==== http://www.ucodice.com/articles/ftp-500-illegal-port-command/ ==== 500 OOPS: vsftpd: refusing to run with writable root inside chroot() ==== * http://www.mikestechblog.com/joomla/operating-systems-section/operating-systems-ubuntu/155-500-oops-vsftpd-refusing-to-run-with-writable-root-inside-chroot.html * https://www.benscobie.com/fixing-500-oops-vsftpd-refusing-to-run-with-writable-root-inside-chroot/ * http://agapoff.name/vsftpd-oops.html ==== 500 OOPS: vsftpd: not configured for standalone ==== Добавить в конфиг listen = YES ==== Не видно файлов начинающихся с точки ==== Добавить в конфиг force_dot_files = YES ==== Баг в Ubuntu в виртуальной среде XEN ==== Ошибка при запуске service vsftpd start получаем сообщение 500 OOPS: munmap Баг - https://bugs.launchpad.net/ubuntu/+source/vsftpd/+bug/1313450 Обсуждение * http://askubuntu.com/questions/457248/vsftpd-not-working * http://askubuntu.com/questions/453784/vsftpd-installation-not-working-on-virtual-server-as-of-14-04