﻿define('DISALLOW_FILE_EDIT', true);
define('DISALLOW_FILE_MODS', true);<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>/dev/head &#187; mysql</title>
	<atom:link href="http://devhead.ru/cat/mysql/feed" rel="self" type="application/rss+xml" />
	<link>http://devhead.ru</link>
	<description>Статьи и видео уроки</description>
	<lastBuildDate>Mon, 30 Jan 2017 11:12:34 +0000</lastBuildDate>
	<language>ru-RU</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.1.37</generator>
	<item>
		<title>Настройка  proftpd с хранением пользователей в MySQL</title>
		<link>http://devhead.ru/read/nastrojka-proftpd-s-xraneniem-polzovatelej-v-mysql</link>
		<comments>http://devhead.ru/read/nastrojka-proftpd-s-xraneniem-polzovatelej-v-mysql#comments</comments>
		<pubDate>Wed, 03 Nov 2010 14:44:31 +0000</pubDate>
		<dc:creator><![CDATA[ignusius]]></dc:creator>
				<category><![CDATA[Статьи]]></category>
		<category><![CDATA[ftp]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[proftpd]]></category>

		<guid isPermaLink="false">http://devhead.ru/read/nastrojka-i-ustanovka-proftpd-servera-s-xraneniem-akkauntovpolzovatelej-v-mysql/</guid>
		<description><![CDATA[ProFTPd — FTP-сервер для Linux и UNIX-подобных операционных систем. ProFTPd использует лишь один конфигурационный файл «proftpd.conf», который располагается по умолчанию в: Linux — «/etc/proftpd/proftpd.conf» FreeBSD — «/usr/local/etc/proftpd.conf» Сервер может быть настроен для работы нескольких виртуальных хостов, также поддерживает chroot. Может быть запущен в виде отдельного сервера (демона) или в составе суперсервера inetd. Также поддерживает IPv6. [&#8230;]]]></description>
				<content:encoded><![CDATA[<div><b>ProFTPd</b> — FTP-<span class="mw-redirect">сервер</span> для Linux и <span class="mw-redirect">UNIX-подобных операционных систем</span>.</div>
<div>ProFTPd использует лишь один конфигурационный файл «proftpd.conf», который располагается по умолчанию в:</div>
<div>
<ul>
<li>Linux — «/etc/proftpd/proftpd.conf»</li>
<li>FreeBSD — «/usr/local/etc/proftpd.conf»</li>
</ul>
</div>
<div>Сервер может быть настроен для работы нескольких виртуальных хостов, также поддерживает chroot. Может быть запущен в виде отдельного сервера (демона) или в составе суперсервера <span class="new">inetd</span>. Также поддерживает IPv6.</div>
<div>Расширения: поддерживает модули, добавляющие SSL/TLS шифрование, аутентификацию через LDAP, работу с SQL, туннелирование соединений через SSH.</div>
<div><span id="more-503"></span></div>
<h3><span class="mw-headline">Установка:</span></h3>
<blockquote>
<div class="brush: bash">sudo aptitude install proftpd</div>
</blockquote>
<h4><span class="editsection"> </span><strong><span class="mw-headline">Конфигурирование:</span></strong></h4>
<h3><span class="editsection"> </span></h3>
<div><strong><span class="mw-headline">Файл /etc/proftp/proftp.conf</span></strong></div>
<pre><pre class="brush: xhtml">ServerName			"ProFTPD Default Installation"
ServerType			standalone
DefaultServer		on
# Port 21 is the standard FTP port.
Port				21

# Umask 022 Стандартная маска для новых директорий и файлов (777 - 755 = 022)
Umask				022

# 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 the maximum number of processes per service
# (such as xinetd).
MaxInstances		30

# Группа и пользователь от которого запускаем сервер
User				proftpd
Group				proftpd

# Как хранить пароли в базе Plaintext,Crypt,md5 (Plaintext простым текстом)
SQLAuthTypes Plaintext
# Кого аутентифицируем по sql(только пользователей) users - только
пользователей, groups  - только группы no - никого
SQLAuthenticate users

# Минимальный GID и UID аутентифицирумого по sql пользователя
SQLMinUserGID 80
SQLMinUserUID 80

# Информация для подключения к базе данных
# база_данных@адрес_базы_данных:порт логин пароль
SQLConnectInfo proftp@localhost:3306 proftp proftp

# Название таблицы и полей пользователей в базе данных
# таблица имя_пользователя пароль_пользователя UID GID куда_cheroot'ить
# шелл_пользователя
SQLUserInfo users_table username password uid gid homedir shell

# Использовать системный шелл при авторизации? 
#(который хранится в /etc/shell) НЕТ!
RequireValidShell off

# Лог sql сессии
SQLLogFile /var/log/proftpsql.log

# chroot'ить пользователей в их домашние дериктории
DefaultRoot  ~ 

# права для домашних деррикторий пользователей
&lt;Directory ~&gt;
 	AllowOverwrite	on
 	&lt;Limit WRITE&gt;
		AllowAll
	&lt;/Limit&gt;
	&lt;Limit READ&gt;
		AllowAll
	&lt;/Limit&gt;
&lt;/Directory&gt;

# Конфигурация анонимного пользователя и дериктории для него
&lt;Anonymous /home/ftp&gt;
	User				ftp
	Group				ftp

	# разрешаем пользователя 'anonymous' с правами 'ftp' (делаем алиас)
	UserAlias			anonymous ftp

	# максимальное колличество подключенных анонимных клиентов
	MaxClients			10

	# 'welcome.msg' отображается при входе на сервер
	DisplayLogin	        welcome.msg
       # '.message' отображается при смене каталога
	DisplayChdir		.message
	
	&lt;Limit LOGIN CWD DIRS READ LIST&gt;
		AllowAll
	&lt;/Limit&gt;
	# запрещаем запись анонимному пользователю
	&lt;Limit WRITE&gt;
		DenyAll
	&lt;/Limit&gt;
&lt;/Anonymous&gt;
&lt;/pre&gt;</pre>
<p></p>
<h3><span class="editsection"> </span><span class="mw-headline">Авторизация через MySQL.</span></h3>
<div><span class="editsection"> </span><strong><span class="mw-headline">Создание базы:</span></strong></div>
<div>
<pre class="brush: sql">CREATE DATABASE proftp;</pre>
</div>
<div><span class="editsection"> </span><strong><span class="mw-headline">Создание структуры таблицы с пользователями:</span></strong></div>
<pre><pre class="brush: sql">DROP TABLE IF EXISTS `proftp.users_table`;
CREATE TABLE `users_table` (
  `unic_id` int(11) NOT NULL auto_increment,
  `username` varchar(20) NOT NULL,
  `password` varchar(20) NOT NULL,
  `groupname` varchar(24) NOT NULL,
  `uid` int(11) NOT NULL,
  `gid` int(11) NOT NULL,
  `homedir` varchar(50) NOT NULL,
  `shell` varchar(20) NOT NULL,
  `last_login` int(15) NOT NULL,
 `login_count` int(15) NOT NULL,
  `last_err_login` int(15) NOT NULL,
  `err_login_count` int(15) NOT NULL,
  PRIMARY KEY  (`unic_id`)
) ENGINE=MyISAM COMMENT='Таблица пользователей';</pre>
<p></p>
<div><span class="editsection"> </span><strong><span class="mw-headline">Создание учетных записей:</span></strong></div>
<div>
<pre class="brush: sql">INSERT INTO `users_table` VALUES (1,'user1','123','users',65534,65534,
'/home/ftp','/sbin/nologin',0,0,0,0);
INSERT INTO `users_table` VALUES (2,'user2','123','users',65534,65534,
'/home/ftp','/sbin/nologin',0,0,0,0);
INSERT INTO `users_table` VALUE (3,'admin','secure%pass','admin',103,1001,
'/home/ftp','/sbin/nologin',0,0,0,0);</pre>
</div>
<div><strong><span class="editsection"> </span><span class="mw-headline">Содание пользователя для доступа к базе данных:</span></strong></div>
<pre><pre class="brush: sql">GRANT SELECT ON proftp.* TO 'proftp'@'localhost' IDENTIFIED BY 'proftp';</pre>
<h3><span class="editsection"> </span><span class="mw-headline">Авторизация через локальный файл</span></h3>
<p><span class="editsection"> </span><span style="color: #ff0000" class="mw-headline">Правило iptables</span></p>
<div><strong><span class="editsection"> </span><span class="mw-headline">Пассивный режим:</span></strong></div>
<div>
<pre class="brush: bash">iptables -t filter -A INPUT -i ppp0 --protocol tcp --dport 21 -j ACCEPT
iptables -t filter -A INPUT -i ppp0 --protocol tcp --dport 49152:65534 -j ACCEPT</pre>
</div>
<p>где ppp0 интерфейс светящий в интернет</p>
<p><a name=".D0.90.D0.BA.D1.82.D0.B8.D0.B2.D0.BD.D1.8B.D0.B9_.D1.80.D0.B5.D0.B6.D0.B8.D0.BC" id=".D0.90.D0.BA.D1.82.D0.B8.D0.B2.D0.BD.D1.8B.D0.B9_.D1.80.D0.B5.D0.B6.D0.B8.D0.BC"></a></p>
<div><span class="editsection"> </span><strong><span class="mw-headline">Активный режим:</span></strong></div>
<p>Для активного режима достаточно разрешить входящие только для порта данных:</p>
<pre><pre class="brush: bash">iptables -t filter -A INPUT -i ppp0 --protocol tcp --dport 21 -j ACCEPT</pre>
<h3><span class="mw-headline">Ссылки:</span></h3>
<p><a href="http://www.lissyara.su/?id=1144" class="external text" title="http://www.lissyara.su/?id=1144" rel="nofollow">proftpd с хранением пользователей в MySQL</a><br /> <a href="http://www.proftpd.org/" class="external text" title="http://www.proftpd.org/" rel="nofollow">Официальный сайт proftp</a><br /> <a href="http://www.bog.pp.ru/work/ProFTPD.html" class="external text" title="http://www.bog.pp.ru/work/ProFTPD.html" rel="nofollow">Bog BOS: FTP-сервер ProFTPD: установка, настройка и использование</a> <br /> <a href="http://www.netpromoter.ru/linkutility/help/ftp.html" class="external text" title="http://www.netpromoter.ru/linkutility/help/ftp.html" rel="nofollow">FTP – активный и пассивный режимы</a> <br /> <a href="http://uvsw.narod.ru/project/proftpd.html" class="external text" title="http://uvsw.narod.ru/project/proftpd.html" rel="nofollow">Виртуальные, неанонимные пользователи proftpd</a> <br /> <a href="http://www.bog.pp.ru/work/ProFTPD.html" class="external text" title="http://www.bog.pp.ru/work/ProFTPD.html" rel="nofollow">FTP-сервер ProFTPD: установка, настройка и использование</a></p>
]]></content:encoded>
			<wfw:commentRss>http://devhead.ru/read/nastrojka-proftpd-s-xraneniem-polzovatelej-v-mysql/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->