{"id":44,"date":"2008-08-26T09:24:06","date_gmt":"2008-08-26T07:24:06","guid":{"rendered":"http:\/\/wp1.fredptitgars.net\/index.php\/2008\/08\/26\/installation-de-proftp\/"},"modified":"2008-08-26T09:24:06","modified_gmt":"2008-08-26T07:24:06","slug":"installation-de-proftp","status":"publish","type":"post","link":"https:\/\/fredptitgars.ovh\/?p=44","title":{"rendered":"Installation de proftp"},"content":{"rendered":"<p>comme d&rsquo;hab:<\/p>\n<p><code><br \/>\napt-get install proftpd proftpd-mysql<br \/>\n<\/code><\/p>\n<p>le lancement se fait par inetd<\/p>\n<p>la cr\u00e9ation des tables:<\/p>\n<p><code><br \/>\nCREATE DATABASE `proftpd`;<br \/>\nUSE proftpd;<\/p>\n<p>&mdash;&nbsp;<br \/>\n<br \/>&mdash;&nbsp;Table structure for table `ftpgroup`<br \/>\n<br \/>&mdash;&nbsp;<br \/>\nCREATE TABLE `ftpgroup` (<br \/>\n`groupname` varchar(16) NOT NULL DEFAULT '',<br \/>\n`gid` smallint(6) NOT NULL DEFAULT '5500',<br \/>\n`members` varchar(16) NOT NULL DEFAULT '',<br \/>\nKEY `groupname` (`groupname`)<br \/>\n) TYPE=MyISAM COMMENT='Table des groupes ProFTPD';<\/p>\n<p>&mdash;&nbsp;<br \/>\n<br \/>&mdash;&nbsp;Table structure for table `ftpquotalimits`<br \/>\n<br \/>&mdash;&nbsp;<br \/>\nCREATE TABLE `ftpquotalimits` (<br \/>\n`name` varchar(30) DEFAULT NULL,<br \/>\n`quota_type` enum('user','group','class','all') NOT NULL DEFAULT 'user',<br \/>\n`par_session` enum('false','true') NOT NULL DEFAULT 'false',<br \/>\n`limit_type` enum('soft','hard') NOT NULL DEFAULT 'soft',<br \/>\n`bytes_up_limit` float NOT NULL DEFAULT '0',<br \/>\n`bytes_down_limit` float NOT NULL DEFAULT '0',<br \/>\n`bytes_transfer_limit` float NOT NULL DEFAULT '0',<br \/>\n`files_up_limit` int(10) UNSIGNED NOT NULL DEFAULT '0',<br \/>\n`files_down_limit` int(10) UNSIGNED NOT NULL DEFAULT '0',<br \/>\n`files_transfer_limit` int(10) UNSIGNED NOT NULL DEFAULT '0'<br \/>\n) TYPE=MyISAM COMMENT='Table des quotas ProFTPD';<\/p>\n<p>&mdash;&nbsp;<br \/>\n<br \/>&mdash;&nbsp;Table structure for table `ftpquotatotal`<br \/>\n<br \/>&mdash;&nbsp;<br \/>\nCREATE TABLE `ftpquotatotal` (<br \/>\n`name` varchar(30) NOT NULL DEFAULT '',<br \/>\n`quota_type` enum('user','group','class','all') NOT NULL DEFAULT 'user',<br \/>\n`bytes_up_total` float NOT NULL DEFAULT '0',<br \/>\n`bytes_down_total` float NOT NULL DEFAULT '0',<br \/>\n`bytes_transfer_total` float NOT NULL DEFAULT '0',<br \/>\n`files_up_total` int(10) UNSIGNED NOT NULL DEFAULT '0',<br \/>\n`files_down_total` int(10) UNSIGNED NOT NULL DEFAULT '0',<br \/>\n`files_transfer_total` int(10) UNSIGNED NOT NULL DEFAULT '0'<br \/>\n) TYPE=MyISAM COMMENT='Table des compteurs des quotas ProFTPD';<\/p>\n<p>&mdash;&nbsp;<br \/>\n<br \/>&mdash;&nbsp;Table structure for table `ftpuser`<br \/>\n<br \/>&mdash;&nbsp;<br \/>\nCREATE TABLE `ftpuser` (<br \/>\n`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,<br \/>\n`userid` varchar(32) NOT NULL DEFAULT '',<br \/>\n`passwd` varchar(32) NOT NULL DEFAULT '',<br \/>\n`uid` smallint(6) NOT NULL DEFAULT '5500',<br \/>\n`gid` smallint(6) NOT NULL DEFAULT '5500',<br \/>\n`homedir` varchar(255) NOT NULL DEFAULT '',<br \/>\n`shell` varchar(16) NOT NULL DEFAULT '\/bin\/false',<br \/>\n`count` int(11) NOT NULL DEFAULT '0',<br \/>\n`accessed` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',<br \/>\n`modified` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',<br \/>\n`LoginAllowed` enum('true','false') NOT NULL DEFAULT 'true',<br \/>\nPRIMARY KEY (`id`)<br \/>\n) TYPE=MyISAM COMMENT='Table des utlisateurs ProFTPD';<br \/>\n<\/code><\/p>\n<p>La config de proftp dans le fichier \/etc\/proftpd\/proftpd.conf:<\/p>\n<p>on d\u00e9commente:<\/p>\n<p><code><br \/>\nDefaultRoot            &nbsp;<br \/>\nRequireValidShell        off<br \/>\n<IfModule mod_sql.c><br \/>\n   SQLBackend            mysql<br \/>\n<\/IfModule><br \/>\n<\/code><\/p>\n<p>on ajoute \u00e0 la fin: <\/p>\n<p><code><br \/>\n# Mod MySQL<br \/>\n# =========<br \/>\n# Les mots de passe sont cryptes dans la base avec la fonction ENCRYPT (MySQL)<br \/>\nSQLAuthTypes Crypt<br \/>\nSQLAuthenticate users* groups*<\/p>\n<p># Modifiez cette ligne selon l'utilisateur et le mot de passe definit plutot<br \/>\nSQLConnectInfo proftpd@localhost proftpd proftpd<\/p>\n<p># On donne a ProFTPd le nom des colonnes de la table usertable<br \/>\nSQLUserInfo ftpuser userid passwd uid gid homedir shell<br \/>\nSQLUserWhereClause \"LoginAllowed = 'true'\"<\/p>\n<p># On donne a ProFTPd le nom des colonnes de la table \"grouptable\"<br \/>\nSQLGroupInfo ftpgroup groupname gid members<\/p>\n<p># Creer le repertoire home de l'utilisateur si il n'existe pas<br \/>\nSQLHomedirOnDemand on<\/p>\n<p># Met a jour les compteurs a chaque connection d'un utilisateur<br \/>\nSQLLog PASS updatecount<br \/>\nSQLNamedQuery updatecount UPDATE \"count=count+1, accessed=now() WHERE userid='%u'\" ftpuser<\/p>\n<p>#Met a jour les compteurs a chaque upload ou download d'un utilisateur<br \/>\nSQLLog STOR,DELE modified<br \/>\nSQLNamedQuery modified UPDATE \"modified=now() WHERE userid='%u'\" ftpuser<\/p>\n<p># Mod quota<br \/>\n# =========<br \/>\nQuotaEngine on<br \/>\nQuotaDirectoryTally on<br \/>\nQuotaDisplayUnits Mb<br \/>\nQuotaShowQuotas on<\/p>\n<p># Definit les requetes SQL pour que ProFTPd recupere les infos sur les quotas<br \/>\nSQLNamedQuery get-quota-limit SELECT \"name, quota_type, par_session, limit_type, bytes_up_limit, bytes_down_limit, bytes_transfer_limit, files_up_limit, files_down_limit, files_transfer_limit FROM ftpquotalimits WHERE name = '%<em>0<\/em>' AND quota_type = '%<em>1<\/em>'\"<br \/>\nSQLNamedQuery get-quota-tally SELECT \"name, quota_type, bytes_up_total, bytes_down_total, bytes_transfer_total, files_up_total, files_down_total, files_transfer_total FROM ftpquotatotal WHERE name = '%<em>0<\/em>' AND quota_type = '%<em>1<\/em>'\"<br \/>\nSQLNamedQuery update-quota-tally UPDATE \"bytes_up_total = bytes_up_total + %<em>0<\/em>, bytes_down_total = bytes_down_total + %<em>1<\/em>, bytes_transfer_total = bytes_transfer_total + %<em>2<\/em>, files_up_total = files_up_total + %<em>3<\/em>, files_down_total = files_down_total + %<em>4<\/em>, files_transfer_total = files_transfer_total + %<em>5<\/em> WHERE name = '%<em>6<\/em>' AND quota_type = '%<em>7<\/em>'\" ftpquotatotal<br \/>\nSQLNamedQuery insert-quota-tally INSERT \"%<em>0<\/em>, %<em>1<\/em>, %<em>2<\/em>, %<em>3<\/em>, %<em>4<\/em>, %<em>5<\/em>, %<em>6<\/em>, %<em>7<\/em>\" ftpquotatotal<\/p>\n<p>QuotaLimitTable sql:\/get-quota-limit<br \/>\nQuotaTallyTable sql:\/get-quota-tally\/update-quota-tally\/insert-quota-tally<\/p>\n<p># Gestion des logs<br \/>\n# ================<br \/>\n# Enregistre les requetes SQL dans \/var\/log\/proftpd\/mysql.log<br \/>\nSQLLogFile \/var\/log\/proftpd\/mysql.log<\/p>\n<p># Enregistre les authentifications<br \/>\nLogFormat auth \"%v [%P] %h %t \\\"%r\\\" %s\"<br \/>\nExtendedLog \/var\/log\/proftpd\/auth.log AUTH auth<\/p>\n<p># Enregistre les acces aux fichiers<br \/>\nLogFormat write \"%h %l %u %t \\\"%r\\\" %s %b\"<br \/>\nExtendedLog \/var\/log\/proftpd\/access.log WRITE,READ write<\/p>\n<p><\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>comme d&rsquo;hab: apt-get install proftpd proftpd-mysql le lancement se fait par inetd la cr\u00e9ation des tables: CREATE DATABASE `proftpd`; USE proftpd; &mdash;&nbsp; &mdash;&nbsp;Table structure for table `ftpgroup` &mdash;&nbsp; CREATE TABLE `ftpgroup` ( `groupname` varchar(16) NOT NULL DEFAULT \u00a0\u00bb, `gid` smallint(6) NOT NULL DEFAULT &lsquo;5500&rsquo;, `members` varchar(16) NOT NULL DEFAULT \u00a0\u00bb, KEY `groupname` (`groupname`) ) TYPE=MyISAM [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[],"class_list":["post-44","post","type-post","status-publish","format-standard","hentry","category-poweredge-t105"],"blocksy_meta":[],"_links":{"self":[{"href":"https:\/\/fredptitgars.ovh\/index.php?rest_route=\/wp\/v2\/posts\/44","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fredptitgars.ovh\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fredptitgars.ovh\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fredptitgars.ovh\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/fredptitgars.ovh\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=44"}],"version-history":[{"count":0,"href":"https:\/\/fredptitgars.ovh\/index.php?rest_route=\/wp\/v2\/posts\/44\/revisions"}],"wp:attachment":[{"href":"https:\/\/fredptitgars.ovh\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=44"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fredptitgars.ovh\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=44"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fredptitgars.ovh\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=44"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}