{"id":2673,"date":"2016-10-02T08:40:46","date_gmt":"2016-10-02T06:40:46","guid":{"rendered":"http:\/\/www.extradrm.com\/?p=2673"},"modified":"2016-11-20T22:53:44","modified_gmt":"2016-11-20T20:53:44","slug":"install-ftp-server-with-pureftpd-and-mysql","status":"publish","type":"post","link":"https:\/\/www.extradrm.com\/?p=2673","title":{"rendered":"Install FTP server with PureFTPd and MySQL on Debian"},"content":{"rendered":"<h2>Install MySQL<\/h2>\n<p>&gt; sudo apt-get install mysql-server<\/p>\n<p>During the installation process, you will be prompted to set a password for the MySQL root user as shown below. Choose a strong password and keep it in a safe place for future reference. MySQL will bind to localhost (127.0.0.1) by default.<\/p>\n<h2>Install\u00a0interactive process viewer Htop<\/h2>\n<p>&gt;sudo apt-get install htop<br \/>\n<a href=\"http:\/\/www.extradrm.com\/wp-content\/uploads\/2016\/10\/pureftpd004.jpg\"><img loading=\"lazy\" class=\"aligncenter size-large wp-image-2699\" alt=\"pureftpd004\" src=\"http:\/\/www.extradrm.com\/wp-content\/uploads\/2016\/10\/pureftpd004-1024x56.jpg\" width=\"600\" height=\"32\" srcset=\"https:\/\/www.extradrm.com\/wp-content\/uploads\/2016\/10\/pureftpd004-1024x56.jpg 1024w, https:\/\/www.extradrm.com\/wp-content\/uploads\/2016\/10\/pureftpd004-300x16.jpg 300w, https:\/\/www.extradrm.com\/wp-content\/uploads\/2016\/10\/pureftpd004.jpg 1101w\" sizes=\"(max-width: 600px) 100vw, 600px\" \/><\/a><\/p>\n<h2 id=\"setting-up-phpmyadmin\">Install and Setting Up phpMyAdmin<\/h2>\n<ol>\n<li>Install the current version of phpMyAdmin:\n<div>\n<table>\n<tbody>\n<tr>\n<td>\n<pre>1<\/pre>\n<\/td>\n<td>\n<pre>sudo apt-get install phpmyadmin<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>You will be asked which server to automatically configure phpMyAdmin for. Select \u201capache2.\u201d When asked to configure database for phpmyadmin with dbconfig-common, select yes.<\/li>\n<\/ol>\n<h2 id=\"using-mysql\">Using MySQL<\/h2>\n<p>The standard tool for interacting with MySQL is the <code>mysql<\/code> client which installs with the <code>mysql-server<\/code> package. The MySQL client is used through a terminal.<br \/>\n* If you are more confortable with Gui interface so Phpmyadim was installed too (<strong>http:\/\/yourIP\/phpmyadmin<\/strong>)<\/p>\n<h3 id=\"root-login\">Root Login<\/h3>\n<ol>\n<li>To log in to MySQL as the root user:\n<div>\n<table>\n<tbody>\n<tr>\n<td>\n<pre>1<\/pre>\n<\/td>\n<td>\n<pre>mysql -u root -p<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/li>\n<li>When prompted, enter the root password. You\u2019ll then be presented with a welcome header and the MySQL prompt as shown below:\n<div>\n<table>\n<tbody>\n<tr>\n<td>\n<pre>1<\/pre>\n<\/td>\n<td>\n<pre>mysql&gt;<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/li>\n<\/ol>\n<p><span style=\"font-family: Verdana,Arial,Helvetica,sans-serif; font-size: small;\"><strong>Now we create a database called<\/strong> <span style=\"font-family: Courier New,Courier,mono;\"><i>pureftpd<\/i><\/span> and a MySQL user named <i><span style=\"font-family: Courier New,Courier,mono;\">pureftpd<\/span><\/i> which the PureFTPd daemon will use later on to connect to the <span style=\"font-family: Courier New,Courier,mono;\"><i>pureftpd<\/i><\/span> database: <\/span><\/p>\n<p><span style=\"font-family: Courier New,Courier,mono;\"><i><span style=\"font-size: small;\">mysql -u root -p<br \/>\nmysql&gt; CREATE DATABASE pureftpd;<\/span><\/i><\/span><\/p>\n<p>GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP ON pureftpd.* TO &#8216;pureftpd&#8217;@&#8217;localhost&#8217; IDENTIFIED BY &#8216;ftpdpass&#8217;;<\/p>\n<p>GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP ON pureftpd.* TO &#8216;pureftpd&#8217;@&#8217;localhost.localdomain&#8217; IDENTIFIED BY &#8216;ftpdpass&#8217;;<\/p>\n<p>FLUSH PRIVILEGES;<\/p>\n<p><span style=\"text-decoration: underline;\"><strong>Next we create a custom mysql Table according to our needs and the options explained below &#8230;<\/strong><\/span><\/p>\n<pre>CREATE TABLE `<strong>users<\/strong>` (\r\n `Id` int(11) NOT NULL auto_increment,\r\n `User` varchar(32) NOT NULL default '',\r\n `Password` varchar(64) NOT NULL default '',\r\n `Uid` int(3) NOT NULL default '<strong>2001<\/strong>',\r\n `Gid` int(3) NOT NULL default '<strong>2001<\/strong>',\r\n `Dir` varchar(255) NOT NULL default '',\r\n `QuotaSize` int(4) NOT NULL default '250',\r\n `ULBandwidth` int(2) NOT NULL default '100',\r\n `DLBandwidth` int(2) NOT NULL default '100',\r\n PRIMARY KEY\u00a0 (`ID`),\r\n UNIQUE KEY `User` (`User`)\r\n);<\/pre>\n<p>&nbsp;<\/p>\n<table border=\"2\" rules=\"all\" cellspacing=\"4\" cellpadding=\"3\">\n<tbody>\n<tr>\n<th bgcolor=\"#A7C1F2\">Column<\/th>\n<th bgcolor=\"#A7C1F2\">Description<\/th>\n<\/tr>\n<tr>\n<td>user<\/td>\n<td>The name of the virtual PureFTPd user<\/td>\n<\/tr>\n<tr>\n<td>status<\/td>\n<td>0 or 1. 0 means the account is disabled, the user cannot login.<\/td>\n<\/tr>\n<tr>\n<td>password<\/td>\n<td>The password of the virtual user. Make sure you use MySQL&#8217;s encrypt function to save the password in encrypted form<\/td>\n<\/tr>\n<tr>\n<td>uid<\/td>\n<td>The userid of the ftp user you created at the end of step two (e.g. 2001).<\/td>\n<\/tr>\n<tr>\n<td>gid<\/td>\n<td>The groupid of the ftp group you created at the end of step two (e.g. 2001).<\/td>\n<\/tr>\n<tr>\n<td>dir<\/td>\n<td>The home directory of the virtual PureFTPd user (e.g. \/home\/www.example.com). If it does not exist, it will be created when the new user logs in the first time via FTP. The virtual user will be jailed into this home directory, i.e., he cannot access other directories outside his home directory.<\/td>\n<\/tr>\n<tr>\n<td>ulbandwidth<\/td>\n<td>Upload bandwidth of the virtual user in KB\/sec. (kilobytes per second). 0 means unlimited.<\/td>\n<\/tr>\n<tr>\n<td>dlbandwidth<\/td>\n<td>Download bandwidth of the virtual user in KB\/sec. (kilobytes per second). 0 means unlimited.<\/td>\n<\/tr>\n<tr>\n<td>comment<\/td>\n<td>You can enter any comment here (e.g. for your internal administration) here. Normally you leave this field empty.<\/td>\n<\/tr>\n<tr>\n<td>ipaccess<\/td>\n<td>Enter IP addresses here that are allowed to connect to this FTP account. * means any IP address is allowed to connect.<\/td>\n<\/tr>\n<tr>\n<td>quotasize<\/td>\n<td><strong>Storage space in MB<\/strong> (not KB, as in ULBandwidth and DLBandwidth!) the virtual user is allowed to use on the FTP server. 0 means unlimited.<\/td>\n<\/tr>\n<tr>\n<td>quotafiles<\/td>\n<td>amount of files the virtual user is allowed to save on the FTP server. 0 means unlimited.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>Insert a new User in the Database \/ Note Password MD5 or ClearText :<\/h4>\n<pre>INSERT INTO `users` ( `User` , `Password` , `Uid` , `Gid` , `Dir`, `Quotasize`,`ULBandwidth`, `ULBandwidth` )\r\nVALUES ('web', MD5( 'PASS_FTP_USER' ) , '2001', '2001', '\/home\/ftp\/users\/U1', `250`, `0`, `0`);<\/pre>\n<h3>Install PureFTPd With MySQL Support<\/h3>\n<p>&gt; sudo apt-get install pure-ftpd pure-ftpd-common<\/p>\n<p>&gt; sudo apt-get install pure-ftpd-mysql<\/p>\n<p>&nbsp;<\/p>\n<p>Then we create a ftp group (<i>ftpgroup<\/i>) and user (<i>ftpuser<\/i>) that all virtual users will be mapped to. Replace the group and userid 2001 with a number that is free on your system:<\/p>\n<pre>&gt; groupadd -g 2001 ftpgroup\r\n&gt; useradd -u 2001 -s \/bin\/false -d \/bin\/null -c \"pureftpd user\" -g ftpgroup ftpuser<\/pre>\n<p><span style=\"text-decoration: underline;\"><strong>Assign Linux rights to the user Folder :<\/strong><\/span><br \/>\n&gt; sudo mkdir<em> \/home\/ftpuser\/test1<\/em><\/p>\n<p>&gt; sudo chown -R ftpuser:ftpgroup <em>\/home\/ftpuser\/test1<\/em><\/p>\n<h3><\/h3>\n<h3>The configuration files of Pure-FTPd<\/h3>\n<p>All files on the FTP server are in \/ etc \/ pure-ftpd \/, configuration files are in the &#8220;conf&#8221; folder and file for the database is in &#8220;db&#8221;.<\/p>\n<p>Unlike users you can add or remove without restarting the server, when you edit a configuration file, remember to reload the configuration with the following command.<\/p>\n<pre>\/etc\/init.d\/pure-ftpd-mysql force-reload<\/pre>\n<p><strong>The configuration files are in \/ etc \/ pure-ftpd \/ conf.<\/strong><\/p>\n<p>The default configuration contains 7 files.<\/p>\n<p>&#8211; AltLog: file to configure the location of logs<\/p>\n<p>&#8211; FSCharset: file for setting the character encoding (UTF8 etc &#8230;)<\/p>\n<p>&#8211; MINUID: file to indicate the minimum UID has access to the server.<\/p>\n<p>&#8211; Noanonymous: file to indicate whether to allow or not the anonymous FTP.<\/p>\n<p>&#8211; PAMAuthentication: file to indicate whether to allow or not authentication PAM.<\/p>\n<p>&#8211; PureDB: file to specify the path to the database of virtual accounts.<\/p>\n<p>&#8211; UnixAuthentication: file to indicate whether to allow or not the standard Unix authentication.<br \/>\n<span style=\"text-decoration: underline;\"><strong>Additional files to create :<\/strong><\/span><br \/>\n<strong><span style=\"color: #0000ff;\">&#8211;\u00a0MaxIdleTime :<\/span><\/strong> Set the timeout by adding a file called &#8220;MaxIdleTime&#8221; inside the conf directory The content of the file should be the number of minutes you like to set the timeout to be. Afterwards just restart your server.<\/p>\n<pre><code>echo 10 &gt; \/etc\/pure-ftpd\/conf\/MaxIdleTime<\/code><\/pre>\n<p><strong><span style=\"color: #0000ff;\">&#8211; <code>PassivePortRange<\/code><\/span><\/strong> : If you run a firewall on your Linux server and want to use passive FTP connections, you have to define the passive port range in pure-ftpd and your firewall to ensure that the connections dont get blocked. The following example is for pure-ftpd on Debian Linux :<\/p>\n<pre><code>echo \"40110 40210\" &gt; \/etc\/pure-ftpd\/conf\/PassivePortRange\r\n\/etc\/init.d\/pure-ftpd-mysql restart<\/code><\/pre>\n<p><a href=\"http:\/\/www.extradrm.com\/wp-content\/uploads\/2016\/10\/pureftpd003.jpg\"><img loading=\"lazy\" class=\"aligncenter size-full wp-image-2688\" alt=\"pureftpd003\" src=\"http:\/\/www.extradrm.com\/wp-content\/uploads\/2016\/10\/pureftpd003.jpg\" width=\"654\" height=\"202\" srcset=\"https:\/\/www.extradrm.com\/wp-content\/uploads\/2016\/10\/pureftpd003.jpg 654w, https:\/\/www.extradrm.com\/wp-content\/uploads\/2016\/10\/pureftpd003-300x92.jpg 300w\" sizes=\"(max-width: 654px) 100vw, 654px\" \/><\/a><br \/>\n<strong><\/strong><\/p>\n<p>Next Update the file <i>\/etc\/pure-ftpd\/conf\/ChrootEveryone<\/i> which simply contains the string yes, and which will make PureFTPd chroot every virtual user in his home directory so he will not be able to browse directories and files outside his home directory<\/p>\n<pre>&gt; echo \"yes\" &gt; \/etc\/pure-ftpd\/conf\/ChrootEveryone<\/pre>\n<p>Next Update the file <i>\/etc\/pure-ftpd\/conf\/NoAnonymous<\/i> to forbid this type of connexion<\/p>\n<pre>&gt; echo \"yes\" &gt; \/etc\/pure-ftpd\/conf\/<i>NoAnonymous<\/i><\/pre>\n<p>Next Update the file <i>\/etc\/pure-ftpd\/conf\/MinUID<\/i> which simply contains the string yes, and which will make PureFTPd chroot every virtual user in his home directory so he will not be able to browse directories and files outside his home directory<\/p>\n<pre>&gt; echo \"yes\" &gt; \/etc\/pure-ftpd\/conf\/ChrootEveryone<\/pre>\n<p>Also Update the file <i>\/etc\/pure-ftpd\/conf\/CreateHomeDir<\/i> which again simply contains the string yes. This will make PureFTPd create a user&#8217;s home directory when the user logs in and the home directory does not yet exist.<\/p>\n<pre>&gt; echo \"yes\" &gt; \/etc\/pure-ftpd\/conf\/CreateHomeDir<\/pre>\n<p><a href=\"http:\/\/www.extradrm.com\/wp-content\/uploads\/2016\/10\/pureftpd002.jpg\"><img loading=\"lazy\" class=\"aligncenter size-large wp-image-2691\" alt=\"pureftpd002\" src=\"http:\/\/www.extradrm.com\/wp-content\/uploads\/2016\/10\/pureftpd002-743x1024.jpg\" width=\"600\" height=\"826\" srcset=\"https:\/\/www.extradrm.com\/wp-content\/uploads\/2016\/10\/pureftpd002-743x1024.jpg 743w, https:\/\/www.extradrm.com\/wp-content\/uploads\/2016\/10\/pureftpd002-217x300.jpg 217w, https:\/\/www.extradrm.com\/wp-content\/uploads\/2016\/10\/pureftpd002.jpg 1300w\" sizes=\"(max-width: 600px) 100vw, 600px\" \/><\/a><\/p>\n<p>Now we must configure PureFTPd as a standalone daemon (it is currently controlled by inetd). To do this, we open <i>\/etc\/default\/pure-ftpd-common<\/i> and change the value of the parameter STANDALONE_OR_INETD to <strong>standalone<\/strong>:<\/p>\n<pre>&gt; sudo nano \/etc\/default\/pure-ftpd-common<\/pre>\n<p>Next, we modify <i>\/etc\/inetd.conf<\/i> and comment out the ftp line so that it looks like this:<\/p>\n<pre>#:STANDARD: These are standard services.\r\n#ftp    stream  tcp nowait  root    \/usr\/sbin\/tcpd \/usr\/sbin\/proftpd<\/pre>\n<h2><strong>Now restart Inetd and PureFTPd mysql :<\/strong><\/h2>\n<pre>&gt; \/etc\/init.d\/openbsd-inetd restart\r\n&gt; \/etc\/init.d\/pure-ftpd-mysql restart<\/pre>\n<p><a href=\"http:\/\/www.extradrm.com\/wp-content\/uploads\/2016\/10\/pureftpd001.jpg\"><img loading=\"lazy\" class=\"aligncenter size-full wp-image-2695\" alt=\"pureftpd001\" src=\"http:\/\/www.extradrm.com\/wp-content\/uploads\/2016\/10\/pureftpd001.jpg\" width=\"997\" height=\"62\" srcset=\"https:\/\/www.extradrm.com\/wp-content\/uploads\/2016\/10\/pureftpd001.jpg 997w, https:\/\/www.extradrm.com\/wp-content\/uploads\/2016\/10\/pureftpd001-300x18.jpg 300w\" sizes=\"(max-width: 997px) 100vw, 997px\" \/><\/a><\/p>\n<h3 id=\"-configure-pureftpd\">Configure PureFTPd with mysql<\/h3>\n<p>In the folder &#8220;conf&#8221;, edit the file MySQLConfigFile to put the path to the configuration file we will create: \/etc\/pure-ftpd\/db\/pure-ftpd-mysql.conf<br \/>\nCreate the MySQL configuration file<\/p>\n<p>Now we create the \/etc\/pure-ftpd\/db\/pure-ftpd-mysql.conf configuration file that will be used to indicate the connection information between the FTP server and MySQL.<\/p>\n<p>nano \/etc\/pure-ftpd\/db\/pure-ftpd-mysql.conf<\/p>\n<table width=\"90%\" border=\"1\" cellspacing=\"0\" cellpadding=\"2\" align=\"center\" bgcolor=\"#CCCCCC\">\n<tbody>\n<tr>\n<td>\n<pre>MYSQLSocket      \/var\/run\/mysqld\/mysqld.sock\r\n#MYSQLServer     localhost\r\n#MYSQLPort       3306\r\nMYSQLUser       pureftpd\r\nMYSQLPassword   ftpdpass\r\nMYSQLDatabase   pureftpd\r\n#MYSQLCrypt md5, cleartext, crypt() or password() - md5 is VERY RECOMMENDABLE uppon cleartext\r\nMYSQLCrypt      md5\r\nMYSQLGetPW      SELECT Password FROM ftpd WHERE User=\"\\L\" AND status=\"1\" AND (ipaccess = \"*\" OR ipaccess LIKE \"\\R\")\r\nMYSQLGetUID     SELECT Uid FROM ftpd WHERE User=\"\\L\" AND status=\"1\" AND (ipaccess = \"*\" OR ipaccess LIKE \"\\R\")\r\nMYSQLGetGID     SELECT Gid FROM ftpd WHERE User=\"\\L\"AND status=\"1\" AND (ipaccess = \"*\" OR ipaccess LIKE \"\\R\")\r\nMYSQLGetDir     SELECT Dir FROM ftpd WHERE User=\"\\L\"AND status=\"1\" AND (ipaccess = \"*\" OR ipaccess LIKE \"\\R\")\r\nMySQLGetBandwidthUL SELECT ULBandwidth FROM ftpd WHERE User=\"\\L\"AND status=\"1\" AND (ipaccess = \"*\" OR ipaccess LIKE \"\\R\")\r\nMySQLGetBandwidthDL SELECT DLBandwidth FROM ftpd WHERE User=\"\\L\"AND status=\"1\" AND (ipaccess = \"*\" OR ipaccess LIKE \"\\R\")\r\nMySQLGetQTASZ   SELECT QuotaSize FROM ftpd WHERE User=\"\\L\"AND status=\"1\" AND (ipaccess = \"*\" OR ipaccess LIKE \"\\R\")\r\nMySQLGetQTAFS   SELECT QuotaFiles FROM ftpd WHERE User=\"\\L\"AND status=\"1\" AND (ipaccess = \"*\" OR ipaccess LIKE \"\\R\")<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Make sure that you replace the string ftpdpass with the real password for the MySQL user pureftpd in the line MYSQLPassword! Please note that we use md5 as MYSQLCrypt method, which means we will store the users&#8217; passwords as an MD5 string in the database which is far more secure than using plain text passwords!<\/p>\n<p>For a more simple table in clear text without IP control\u00a0 ans status the content of this file is :<\/p>\n<pre>#Database connexion\r\nMYSQLServer 127.0.0.1\r\nMYSQLUser pureftpd\r\nMYSQLPassword pwdftp\r\nMYSQLDatabase pureftpd#Parametres supplementaires\r\nMYSQLPort 3306\r\nMYSQLSocket \/var\/lib\/mysql\/mysql.sock# Methode de cryptage du mot de passe\r\n# Parametres possible : 'crypt', 'md5' ou 'cleartext' pour afficher le mot de passe en clair.\r\nMYSQLCrypt cleartext# Requetes SQL permettant a Pure-FTPd de trouver les donnees dans la base\r\nMYSQLGetPW SELECT Password FROM users WHERE User=\"\\L\"\r\nMYSQLGetUID SELECT Uid FROM users WHERE User=\"\\L\"\r\nMYSQLGetGID SELECT Gid FROM users WHERE User=\"\\L\"\r\nMYSQLGetDir SELECT Dir FROM users WHERE User=\"\\L\"\r\nMySQLGetQTASZ SELECT QuotaSize FROM users WHERE User=\"\\L\"\r\nMySQLGetRatioUL SELECT ULRatio FROM users WHERE User=\"\\L\"\r\nMySQLGetRatioDL SELECT DLRatio FROM users WHERE User=\"\\L\"\r\nMySQLGetBandwidthUL SELECT ULBandwidth FROM users WHERE User=\"\\L\"\r\nMySQLGetBandwidthDL SELECT DLBandwidth FROM users WHERE User=\"\\L\"<\/pre>\n<p>&nbsp;<\/p>\n<p><strong>Think to Protect Access<\/strong> to Passwords mysql in File pure-ftpd-mysql.conf<\/p>\n<pre>&gt; chmod 640 pure-ftpd-mysql.conf<\/pre>\n<p><span style=\"text-decoration: underline;\"><strong>Problem on CreateHomeDir :<\/strong><\/span><\/p>\n<p>When Virtual user try to connect :<br \/>\nthey may get this error \u201c<strong>Home directory not available \u2013 abort<\/strong>\u201d even if they set CreateHomeDir to yes.<\/p>\n<p>Solution:<br \/>\nthe last existing in the home path should be own by root.<br \/>\nfor example, we want to create somebody\u2019s home directory when he log in, <strong>\/home\/ftpuser<\/strong>\/somebody<br \/>\nthen the last existing directory \u2018ftpuer\u2019 may look like this,<\/p>\n<p><strong>drwxr-xr-x 2 root ftpgroup 4096 2008-04-15 11:20 ftpuser<\/strong><\/p>\n<p><span style=\"text-decoration: underline;\"><strong>Showing Another example :<\/strong><\/span><\/p>\n<p>sudo mkdir \/home\/ftp<\/p>\n<p>sudo chown root:groupftp \/home\/ftp<br \/>\n<a href=\"http:\/\/www.extradrm.com\/wp-content\/uploads\/2016\/10\/pureftpd005.jpg\"><img loading=\"lazy\" class=\"aligncenter size-full wp-image-2708\" alt=\"pureftpd005\" src=\"http:\/\/www.extradrm.com\/wp-content\/uploads\/2016\/10\/pureftpd005.jpg\" width=\"600\" height=\"154\" srcset=\"https:\/\/www.extradrm.com\/wp-content\/uploads\/2016\/10\/pureftpd005.jpg 600w, https:\/\/www.extradrm.com\/wp-content\/uploads\/2016\/10\/pureftpd005-300x77.jpg 300w\" sizes=\"(max-width: 600px) 100vw, 600px\" \/><\/a><\/p>\n<p><strong>In case CreateHomeDir is set to no, Assign Linux rights to the user Folder :<\/strong><br \/>\n&gt; sudo mkdir<em> \/home\/ftpuser\/test1<\/em><\/p>\n<p>&gt; sudo chown -R ftpuser:ftpgroup <em>\/home\/ftpuser\/test1<\/em><\/p>\n<p>&nbsp;<\/p>\n<h2>Uninstall pure-ftpd-common<\/h2>\n<p>To remove just pure-ftpd-common package itself from Debian 7 (Wheezy) execute on terminal:<\/p>\n<pre>sudo apt-get remove pure-ftpd-common<\/pre>\n<h2>Uninstall pure-ftpd-common and it&#8217;s dependent packages<\/h2>\n<p>To remove the pure-ftpd-common package and any other dependant package which are no longer needed from Debian Wheezy.<\/p>\n<pre>sudo apt-get remove --auto-remove pure-ftpd-common<\/pre>\n<h2>Uninstall pure-ftpd-mysql too<\/h2>\n<pre><code>apt-get --purge remove pure-ftpd-mysql\r\napt-get --purge remove pure-ftpd<\/code><\/pre>\n<h2>Purging pure-ftpd-common<\/h2>\n<p>If you also want to delete configuration and\/or data files of pure-ftpd-common from Debian Wheezy then this will work:<\/p>\n<pre>sudo apt-get purge pure-ftpd-common<\/pre>\n<p>To delete configuration and\/or data files of pure-ftpd-common and it&#8217;s dependencies from Debian Wheezy then execute:<\/p>\n<pre>sudo apt-get purge --auto-remove pure-ftpd-common<\/pre>\n<p><strong>Debian archive repository :<\/strong><br \/>\n<code><\/code><\/p>\n<p>Anyway, when a config file for an installed package is missing, you can use the following command to force dpkg to reinstall original missing configuration files :<\/p>\n<pre><code>dpkg --force-confmiss -i <strong>\/var\/cache\/apt\/archives\/pure-ftpd-mysql_1.0.24-1_i386.deb\r\n<\/strong><\/code><\/pre>\n<p>When use want a complete removing of a package you need to purge it (usually it means removing also config files).<\/p>\n<pre><code>aptitude purge pure-ftpd-mysql\r\n<\/code><\/pre>\n<p>Assuming you don&#8217;t have done an:<\/p>\n<pre><code>apt-get clean\r\n<\/code><\/pre>\n<p>that remove the cache &#8230;<\/p>\n<h2>Starting ans checking service pure-ftpd<\/h2>\n<pre>ps uaxf|grep pure-ftpd\r\nservice pure-ftpd restart\r\nservice pure-ftpd status<\/pre>\n<p><span style=\"text-decoration: underline;\"><strong>Remove a directory recursively with all files inside :<\/strong><\/span><br \/>\nrm -rf mydir<\/p>\n<p><span style=\"text-decoration: underline;\"><strong>Get a list of Open Ports in Linux<\/strong><\/span><\/p>\n<div itemprop=\"text\">\n<pre><code>netstat -lntu\r\n<\/code><\/pre>\n<p>as replied by @askmish will give you list of services running on your system on tcp and udp ports where<\/p>\n<ul>\n<li><code>-l<\/code> = only services which are listening on some port<\/li>\n<li><code>-n<\/code> = show port number, don&#8217;t try to resolve the service name<\/li>\n<li><code>-t<\/code> = tcp ports<\/li>\n<li><code>-u<\/code> = udp ports<\/li>\n<li><code>-p<\/code> = name of the program<\/li>\n<\/ul>\n<p>You don&#8217;t need the &#8216;p&#8217; parameter as you&#8217;re only interested in getting which ports are free and not which program is running on it.<\/p>\n<p>This only shows which ports on your system are used up, though. This doesn&#8217;t tell you the status of your network e.g. if you&#8217;re behind NAT and you want some services to be accessible from outside. Or if the firewall is blocking the port for outside visitors. In that case, nmap comes to the rescue. WARNING: Use nmap only on networks which are under your control. Also, there are firewall rules which can block nmap pings, you&#8217;ll have to fiddle around with options to get correct results.<\/p>\n<p>How to check Firewall Rules :<\/p>\n<p>&gt;\u00a0 iptables -L -v<\/p>\n<p>https:\/\/www.youtube.com\/watch?v=XMvprnhP6wI<\/p>\n<p>Iptables Help :<\/p>\n<p>https:\/\/help.ubuntu.com\/community\/IptablesHowTo<\/p>\n<\/div>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Install MySQL &gt; sudo apt-get install mysql-server During the installation process, you will be prompted to set a password for the MySQL root user as shown below. Choose a strong password and keep it&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":2843,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[34,14],"tags":[345],"youtube_video":null,"_links":{"self":[{"href":"https:\/\/www.extradrm.com\/index.php?rest_route=\/wp\/v2\/posts\/2673"}],"collection":[{"href":"https:\/\/www.extradrm.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.extradrm.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.extradrm.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.extradrm.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2673"}],"version-history":[{"count":0,"href":"https:\/\/www.extradrm.com\/index.php?rest_route=\/wp\/v2\/posts\/2673\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.extradrm.com\/index.php?rest_route=\/wp\/v2\/media\/2843"}],"wp:attachment":[{"href":"https:\/\/www.extradrm.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2673"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.extradrm.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2673"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.extradrm.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2673"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}