<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
    xmlns:content="http://purl.org/rss/1.0/modules/content/"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
    xmlns:atom="http://www.w3.org/2005/Atom">
    <channel>
        <title>quick-tips — LowEndSpirit DEV</title>
        <link>https://dev.lowendspirit.com/index.php?p=/</link>
        <pubDate>Wed, 08 Apr 2026 19:51:50 +0000</pubDate>
        <language>en</language>
            <description>quick-tips — LowEndSpirit DEV</description>
    <atom:link href="https://dev.lowendspirit.com/index.php?p=/discussions/tagged/quick-tips/feed.rss" rel="self" type="application/rss+xml"/>
    <item>
        <title>HTTP Server Setup with a Single Command Line</title>
        <link>https://dev.lowendspirit.com/index.php?p=/discussion/3931/http-server-setup-with-a-single-command-line</link>
        <pubDate>Mon, 21 Mar 2022 20:31:31 +0000</pubDate>
        <category>LES Talk</category>
        <dc:creator>alexxgg</dc:creator>
        <guid isPermaLink="false">3931@/index.php?p=/discussions</guid>
        <description><![CDATA[<p><em>Written by <a href="https://dev.lowendspirit.com/index.php?p=/profile/alexxgg" rel="nofollow">@alexxgg</a>, 19 May 2021</em><br /><small>Article was migrated from WordPress to Vanilla in March 2022</small></p>

<p>
  <img src="https://talk.lowendspirit.com/uploads/editor/y9/8lyyu4b1q32d.png" alt="image" /></p>

<p>This is a guest post by <a rel="nofollow" href="https://talk.lowendspirit.com">forum</a> user <a href="https://dev.lowendspirit.com/index.php?p=/profile/alexxgg" rel="nofollow">@alexxgg</a>,</p>

<p>Hi there!</p>

<p>These days when the internet shares things in milliseconds, who of you have needed to share a file quickly? I bet some of you remember at least one time one of those cases.</p>

<p>As you probably know, in terms of web servers, we can share files with popular software like Apache, Nginx, and Lighttpd but this software need basic configuration, also they consume server resources as long as they’re active.</p>

<p>What if you could set up a basic HTTP web server without installing Apache, Nginx, or Lighttpd? Well, that’s sounds kind of impossible, and even more unbelievable is that you can kill it with Ctrl^C. Thanks to Python3 we can do that with its <a rel="nofollow" href="https://pypi.org/project/httpserver/">HTTP server module</a>.</p>

<p>This module will deploy an HTTP server in any directory of the server, even in the root directory and that sounds ridiculously dangerous, fortunately, the default port of this HTTP server isn’t 80. Instead, it will use port: 8000 but you can assign a custom port, very convenient for NAT environment instances.</p>

<p>Now you can deploy a basic HTTP server -in the current directory with the default port- by typing this single command line:</p>

<pre spellcheck="false" tabindex="0">python3 -m http.server
</pre>

<p>Starting HTTP Server</p>

<p><img src="https://talk.lowendspirit.com/uploads/editor/05/lopja74fwxsh.png" alt="" title="" /></p>

<p>Killing HTTP Server</p>

<p><img src="https://talk.lowendspirit.com/uploads/editor/j0/nzh2vdl7fq70.png" alt="" title="" /></p>

<p>HTTP Server as Shown in Browser</p>

<p><img src="https://talk.lowendspirit.com/uploads/editor/ic/4ppesu0bamvj.png" alt="" title="" /></p>

<p><img src="https://talk.lowendspirit.com/uploads/editor/81/dmmmh9vc0eds.png" alt="" title="" /></p>

<p>You can change the default port (example port: 32085) and specify a directory (example directory: /tmp/) with:</p>

<pre spellcheck="false" tabindex="0">python3 -m http.sever 32085 --directory /tmp/
</pre>

<p>More information about Python3 httpserver module is available <a rel="nofollow" href="https://docs.python.org/3/library/http.server.html">here</a></p>

<p>Also, there is a github page <a rel="nofollow" href="https://github.com/freelamb/simple_http_server">here</a></p>

<p><strong>Note</strong>: of course, you will need to install Python3 in order to use these post example command lines.<br />
Leave a comment to let me know any questions or suggestions.</p>
]]>
        </description>
    </item>
    <item>
        <title>How to change the number of minutes that the sudo password is cached</title>
        <link>https://dev.lowendspirit.com/index.php?p=/discussion/3928/how-to-change-the-number-of-minutes-that-the-sudo-password-is-cached</link>
        <pubDate>Mon, 21 Mar 2022 20:21:02 +0000</pubDate>
        <category>LES Talk</category>
        <dc:creator>mikho</dc:creator>
        <guid isPermaLink="false">3928@/index.php?p=/discussions</guid>
        <description><![CDATA[<p><em>Written by <a href="https://dev.lowendspirit.com/index.php?p=/profile/mikho" rel="nofollow">@mikho</a>, 4 May 2021</em><br /><small>Article was migrated from WordPress to Vanilla in March 2022</small></p>

<p>
  <img src="https://talk.lowendspirit.com/uploads/editor/c2/qds4s5mryuc2.png" alt="image" /></p>

<p>This is a really QUICK TIP!</p>

<p>When you run any command as root, using sudo, the password is remembered for 15 minutes by default.<br />
If you want to change the time that the password is cached, open the terminal (as root) and run:</p>

<pre spellcheck="false" tabindex="0">editor /etc/sudoers 
</pre>

<p>Find this line in the file:</p>

<pre spellcheck="false" tabindex="0">defaults env_reset
</pre>

<p>And change it into:</p>

<pre spellcheck="false" tabindex="0">defaults env_reset , timestamp_timeout=x
</pre>

<p>where “x” is the time in minutes that the password will be cached.</p>

<p>Save and exit and work is done!</p>
]]>
        </description>
    </item>
    <item>
        <title>HOWTO: Locate empty files and directories</title>
        <link>https://dev.lowendspirit.com/index.php?p=/discussion/3930/howto-locate-empty-files-and-directories</link>
        <pubDate>Wed, 05 May 2021 12:00:00 +0000</pubDate>
        <category>LES Talk</category>
        <dc:creator>mikho</dc:creator>
        <guid isPermaLink="false">3930@/index.php?p=/discussions</guid>
        <description><![CDATA[<p><em>Written by <a href="https://dev.lowendspirit.com/index.php?p=/profile/mikho" rel="nofollow">@mikho</a>, 5 May 2021</em><br /><small>Article was migrated from WordPress to Vanilla in March 2022</small></p>

<p>
  <img src="https://talk.lowendspirit.com/uploads/editor/kl/ovtru2uav7gg.png" alt="image" /></p>

<p>When installing software on your VPS you will end up with both empty files and empty directories, often these are used as placeholders/lock files/socket files for communication.</p>

<p>This short guide will give you some examples on how to find those empty files/directories.</p>

<p>The command we are going to use is the “<strong>find</strong>” command. To find empty directories/files in the current directory, you use the parameter “<em><strong>-empty</strong></em>“.</p>

<p>You also have to use the parameter “<em><strong>-type</strong></em>” to define if you are looking for directories (d) or files (f).</p>

<h2 data-id="examples"><strong>Examples</strong></h2>

<p>Here is the command to find empty directories in the current directory:</p>

<pre spellcheck="false" tabindex="0">find ./ -type d -empty
</pre>

<p>And here is the command to find empty files in the current directory:</p>

<pre spellcheck="false" tabindex="0">find ./ -type f -empty
</pre>

<p>If you need to know how many empty files you have in the current directory, pipe the find command to “<em><strong>wc -l</strong></em>“:</p>

<pre spellcheck="false" tabindex="0">find ./ -type f -empty | wc -l
</pre>

<p>Similarly, to recursivly count how many how many files are located under the current directory and sub-directories,  you can use the following command:</p>

<pre spellcheck="false" tabindex="0">find ./ -type f -not -empty | wc -l 
</pre>

<p>To remove all empty directories in the current directory, the command you can use is:</p>

<pre spellcheck="false" tabindex="0">find ./ -type d -empty -exec rmdir {} \;
</pre>

<p><strong>– In all the commands above, the  (./) means the current directory or folder, if you want to perform actions in other directories, just replace the  (./) with the path to the new directory.</strong></p>

<p><strong>– In system directories such as /etc/, there are many empty files and directories.</strong></p>

<p><strong>But it is strongly recommended to not remove them.</strong></p>
]]>
        </description>
    </item>
    <item>
        <title>Low memory usage SMTP Send-Only</title>
        <link>https://dev.lowendspirit.com/index.php?p=/discussion/3925/low-memory-usage-smtp-send-only</link>
        <pubDate>Mon, 21 Mar 2022 20:13:41 +0000</pubDate>
        <category>LES Talk</category>
        <dc:creator>mikho</dc:creator>
        <guid isPermaLink="false">3925@/index.php?p=/discussions</guid>
        <description><![CDATA[<p><em>Written by <a href="https://dev.lowendspirit.com/index.php?p=/profile/mikho" rel="nofollow">@mikho</a>, 1 May 2021</em><br /><small>Article was migrated from WordPress to Vanilla in March 2022</small></p>

<p>
  <img src="https://talk.lowendspirit.com/uploads/editor/kl/ovtru2uav7gg.png" alt="image" /></p>

<p>In the LowEndSpirit, we tend to look for resource-efficient alternatives. Here is an alternative to use instead of Postfix, Sendmail, or Exim.</p>

<p>Often when installing and running a web application or script you need an SMTP server to send an email, rarely there is the need to receive any email. It works equally well using <a rel="nofollow" href="https://linux.die.net/man/8/ssmtp">ssmtp</a>, which also is simple and fast to install. It takes two minutes to install and configure.</p>

<h3 data-id="redhat-centos7-fedora">RedHat, CentOS7, Fedora</h3>

<pre spellcheck="false" tabindex="0">yum install ssmtp
</pre>

<p>If you receive a <em>“Package ssmtp is not available”</em> error, you’ll need to install EPEL on your machine with the following command:</p>

<pre spellcheck="false" tabindex="0">yum --enablerepo=extras install epel-release
</pre>

<p>Once done, you’ll be able to install ssmtp using the above command.</p>

<h2 data-id="ubuntu-debian">Ubuntu, Debian</h2>

<pre spellcheck="false" tabindex="0">apt-get install ssmtp
</pre>

<p>The configuration is done in the <strong><em>/etc/ssmtp/ssmtp.conf</em></strong> and there is only a couple of settings to change:</p>

<p><em><strong>Mailhub</strong></em><br />
The mail server you must send mail through (relay). In this guide we will use GMail smtp Server.<br /><strong><em>From Line Override</em></strong><br />
Set to YES to allow the use of others choose from addresses other than the system itself.<br /><em><strong>AuthUser</strong></em><br />
The username or email adress on the account used to login to gmail.<br /><strong><em>AuthPass</em></strong><br />
The password for above account<br /><strong><em>UseSTARTTLS</em></strong><br />
Set to Yes to use TLS when connecting to the SMTP server.</p>

<pre spellcheck="false" tabindex="0">## Config file for sSMTP sendmail
## The person who gets all mail for userids &lt; 1000
# Make this empty to disable rewriting.
root=postmaster
# The place where the mail goes. The actual machine name is required no
# MX records are consulted. Commonly mailhosts are named mail.domain.com
mailhub=smtp.gmail.com:587
AuthUser=name@gmail.com
AuthPass=YourtopSecretPassw0rd!
UseSTARTTLS=YES 
# Where will the mail seem to come from?
#rewriteDomain= 
# The full hostname
hostname=debianVPS.local 
# Are users allowed to set their own From: address?
# YES - Allow the user to specify their own From: address
# NO - Use the system generated From: 
addressFromLineOverride=YES
</pre>

<p>No reboots required.</p>

<p>To use ssmtp with the PHP <em>mail()</em> function, you have to edit the <em><strong>sendmail_path</strong></em> parameter in <strong><em>php.ini</em></strong> to something like this:</p>

<pre spellcheck="false" tabindex="0">sendmail_path = /usr/sbin/ssmtp -t
</pre>

<p>You have no open ports, everything just works!</p>
]]>
        </description>
    </item>
    <item>
        <title>Reclaim reserved disk space KVM/VMWare/Dedicated</title>
        <link>https://dev.lowendspirit.com/index.php?p=/discussion/3922/reclaim-reserved-disk-space-kvm-vmware-dedicated</link>
        <pubDate>Mon, 21 Mar 2022 20:04:09 +0000</pubDate>
        <category>LES Talk</category>
        <dc:creator>mikho</dc:creator>
        <guid isPermaLink="false">3922@/index.php?p=/discussions</guid>
        <description><![CDATA[<p><em>Written by <a href="https://dev.lowendspirit.com/index.php?p=/profile/mikho" rel="nofollow">@mikho</a>, 29 Apr 2021</em><br /><small>Article was migrated from WordPress to Vanilla in March 2022</small></p>

<p>
  <img src="https://talk.lowendspirit.com/uploads/editor/c2/qds4s5mryuc2.png" alt="image" /></p>

<p>Following up on the bonus tip posted on <a rel="nofollow" href="https://lowendspirit.com/resize-your-kvm-vps-disk-partition-2-methods-and-bonus-tip-to-reclaim-disk-space-easy-mode/">Resize your KVM VPS disk partition, 2 methods and bonus tip to reclaim disk space – Easy mode</a>, here is a longer explanation and guide how to reclaim your reserved disk space.</p>

<hr /><p>Joe Dougherty from <a rel="nofollow" href="https://securedragon.net/">SecureDragon.net</a> (great guy running a great company) sent me a tip about <a rel="nofollow" href="http://www.lowendtalk.com/discussion/33817/reclaim-some-free-space-on-your-server-with-this-weird-trick-kvm-xen-dedi-only">this thread</a> and asked if I could write something about this “weird trick”. Actually it’s not a wierd trick, it’s a built in security feature. The information in this post will only work on dedicated servers or Virtual Servers that utilize full virtualization, meaning that <strong>this won’t work on OpenVZ</strong>.</p>

<hr /><p>On a newly created filesystems (Ext [2/3/4]) some of the space will be allocated for the system superuser (root) as “system reserved”. The default of 5% is meant for system partitions. If something goes wrong and your server consumes all its free disk space, the root user could still log in and check logs/crashdumps/etc and generally fix the situation.</p>

<p>For example, if your disk space fills up, the system logs (<em><code spellcheck="false" tabindex="0">/var/log</code></em>) and root’s mailbox (<em><code spellcheck="false" tabindex="0">/var/mail/root</code></em>) can still receive important information. For a <em><code spellcheck="false" tabindex="0">/home</code></em> or general data storage partition, there’s no need to leave any space for root. For very special needs, you can even change the user that gets this emergency space.</p>

<p>There’s another reason to not allow an ext[23] filesystem to get full, which is <a rel="nofollow" href="http://en.wikipedia.org/wiki/Defragmentation">fragmentation</a>. Ext4 should be better at this, as <a rel="nofollow" href="https://www.redhat.com/archives/ext3-users/2009-January/msg00026.html">explained by Linux filesystem developer/guru Theodore Ts’o</a>:</p>

<blockquote><div>
  <p>If you set the reserved block count to zero, it won't affect performance much except if you run for long periods of time (with lots of file creates and deletes) while the filesystem is almost full (i.e., say above 95%), at which point you'll be subject to fragmentation problems.  Ext4's multi-block allocator is much more fragmentation resistant, because it tries much harder to find contiguous blocks, so even if you don't enable the other ext4 features, you'll see better results simply mounting an ext3 filesystem using ext4 before the filesystem gets completely full.If you are just using the filesystem for long-term archive, where files aren't changing very often (i.e., a huge mp3 or video store), it obviously won't matter.</p>
  
  <p>Theodore Tso </p>
</div></blockquote>

<p>If you have a VPS with small disk size the 5% won’t mean much but if you have a 100GB drive or bigger, it quickly adds up to a vaste amount of unused space. In those cases we could lower the amount of reserved space in order to claim and use a few more GB.</p>

<p>At the time of writing the original post, I actually had an unused XEN VPS so lets have a look at what we can do about this by using that as a real life example.</p>

<p>first we confirm the filesystem parameters by running this <a rel="nofollow" href="https://linux.die.net/man/8/tune2fs">command</a>:</p>

<pre spellcheck="false" tabindex="0"># tune2fs -l /dev/xvda1
</pre>

<p>it will list all information about the disk. This is the output I got from my server:</p>

<pre spellcheck="false" tabindex="0">tune2fs 1.42.5 (29-Jul-2012)
Filesystem volume name:   &lt;none&gt;
Last mounted on:          &lt;not available&gt;
Filesystem UUID:          50fd54e4-7740-4683-b1e5-64e93d6d1e92
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      has_journal ext_attr resize_inode dir_index filetype needs_recovery sparse_super large_file
Filesystem flags:         signed_directory_hash 
Default mount options:    (none)
Filesystem state:         clean
Errors behavior:          Continue
Filesystem OS type:       Linux
Inode count:              9830400
Block count:              39321600
Reserved block count:     1966080
Free blocks:              38473681
Free inodes:              9799099
First block:              0
Block size:               4096
Fragment size:            4096
Reserved GDT blocks:      1014
Blocks per group:         32768
Fragments per group:      32768
Inodes per group:         8192
Inode blocks per group:   512
RAID stride:              1
RAID stripe width:        80
Filesystem created:       Mon Nov 10 19:05:08 2014
Last mount time:          Sun Dec 14 17:25:37 2014
Last write time:          Sun Dec 14 17:25:13 2014
Mount count:              12
Maximum mount count:      34
Last checked:             Mon Nov 10 19:05:08 2014
Check interval:           15552000 (6 months)
Next check after:         Sat May  9 19:05:08 2015
Reserved blocks uid:      0 (user root)
Reserved blocks gid:      0 (group root)
First inode:              11
Inode size:               256
Required extra isize:     28
Desired extra isize:      28
Journal inode:            8
Default directory hash:   half_md4
Directory Hash Seed:      e2ccf267-28ea-4e34-9df0-a349d06f0247
Journal backup:           inode blocks
</pre>

<p>The ineresting part from the output above:</p>

<pre spellcheck="false" tabindex="0">Reserved block count:     1966080
Reserved blocks uid:      0 (user root)
Reserved blocks gid:      0 (group root)
</pre>

<p>Before we move on to the amount of reserved space, take a moment to reflect on what user who is allowed to use the reserved space. By default it is root unless changed by the system administrator.</p>

<p>if you multiply the <em>Reserved Block Count</em> with the current <em>Block Size</em> (also found in the tune2fs output above)</p>

<pre spellcheck="false" tabindex="0">Block size:               4096
</pre>

<p>we get how much space in bytes that is reserved by the system:</p>

<table><tbody><tr><td>Block count * Block Size</td><td>Byte</td><td>Kilobyte</td><td>Megabyte</td><td>Gigabyte</td></tr><tr><td>1966080 * 4096</td><td>8053063680</td><td>7864320</td><td>7680</td><td>7,5</td></tr></tbody></table><p>Doing the same operation using the Block Count value:</p>

<pre spellcheck="false" tabindex="0">Block count:              39321600
</pre>

<p>will give you the Total Disk space of the drive</p>

<table><tbody><tr><td>Block count * Block Size</td><td>Byte</td><td>Kilobyte</td><td>Megabyte</td><td>Gigabyte</td></tr><tr><td>39321600 * 4096</td><td>161061273600</td><td>157286400</td><td>153600</td><td>150</td></tr></tbody></table><p>As you can see (7,5GB out of 150GB) exactly 5% of the disk is reserved space.</p>

<p>As previously mentioned, if you don’t have a large disk it would be wise to not change that 5% value since it could mean that you wont have enough “system reserved space” to recover from a full disk problem.</p>

<p>In my case, 7,5 GB of reserved space is a bit much and I would benefit if this was available for me to store my backups instead. So, how do we change the amount of reserved space?</p>

<p>Since my disk is in total 150GB each percentage is 1,5GB and I think that 1,5GB will be enough for this server, the command to set the reserved space to 1 percent would therefor look like this:</p>

<pre spellcheck="false" tabindex="0"># tune2fs -m 1 /dev/xvda1
</pre>

<p>The returned result :</p>

<pre spellcheck="false" tabindex="0">Setting reserved blocks percentage to 1% (393216 blocks)
</pre>

<p>Keeping in mind that each block is 4096 bytes the above result means the reserved space is:</p>

<pre spellcheck="false" tabindex="0">393216 * 4096 = 1,5 GB
</pre>

<p>Before you jump of joy I would like to end this article with a few words of caution;</p>

<p>While this is a nice way to get some extra space on your server <strong>TAKE EXTREME CARE</strong> if you decide to change the settings on the drive that has the / volume or you could end up with a server that even root can’t save when the disk runs out of space. If you have a secondary drive that only holds data, may it be your mp3 collection or family photos, you can set the reserved space to 0percent on that drive. As long as it is NOT the system drive.</p>
]]>
        </description>
    </item>
    <item>
        <title>Easy add IP to be blocked by iptables</title>
        <link>https://dev.lowendspirit.com/index.php?p=/discussion/3905/easy-add-ip-to-be-blocked-by-iptables</link>
        <pubDate>Mon, 12 Apr 2021 12:00:00 +0000</pubDate>
        <category>LES Talk</category>
        <dc:creator>mikho</dc:creator>
        <guid isPermaLink="false">3905@/index.php?p=/discussions</guid>
        <description><![CDATA[<p><em>Written by <a href="https://dev.lowendspirit.com/index.php?p=/profile/mikho" rel="nofollow">@mikho</a>, 12 Apr 2021</em><br /><small>Article was migrated from WordPress to Vanilla in March 2022</small></p>

<p>Following up on the post on how to loop thru a file and perform an action per line, which you can find here</p>

<p><a href="https://lowendspirit.com/how-to-loop-through-a-file-and-perform-an-action-per-line/" rel="nofollow">https://lowendspirit.com/how-to-loop-through-a-file-and-perform-an-action-per-line/</a></p>

<hr /><p>There is a case when this is useful, adding IPs from a text file into iptables and block their access to your VPS or dedicated server.</p>

<p>if you break down this command with its parameters (<em>iptables being the command</em>)</p>

<pre spellcheck="false" tabindex="0">iptables -A INPUT -s XXX.XXX.XXX.XXX -p udp -m udp --dport 28960:28965 -j DROP
</pre>

<p><u><strong>Parameter</strong>: Explanation</u><br /><strong>-A</strong>: Append this to existing rules<br /><strong>INPUT</strong>: The chain where the rule should be added into<br /><strong>-s XXX.XXX.XXX.XXX</strong>: -s Sets the source for a particular packet, in this case the ip of XXX.XXX.XXX.XXX<br /><strong>-p udp</strong>: -p = Sets the IP protocol for the rule, which can be either icmp, tcp, udp, or all, to match every possible protocol. If this option is omitted when creating a rule, the all option is the default.<br /><strong>-m udp</strong>: -m = match option  Different network protocols provide specialized matching options which may be set in specific ways to match a particular packet using that protocol. Of course, the protocol must first be specified in the iptables command, such as using -p tcp , to make the options for that protocol available.<br /><strong>–dport 28960:28965</strong>: –dport Specifies the destination port of the UDP packet, using the service name, port number, or range of port numbers. The –destination-port match option may be used instead of –dport.  To specify a specific range of port numbers, separate the two numbers with a colon (:), such as our example.  You may also use an exclamation point character (!) as a flag after the –dport option to tell iptables to match all packets which do not use that network service or port.<br /><strong>-j DROP</strong>: -j Tells iptables to jump to a particular target when a packet matches a particular rule. Valid targets to be used include the standard options, ACCEPT, DROP, QUEUE, and RETURN, as well as extended options that are available through modules loaded, such as LOG, MARK, and REJECT, among others. If no target is specified, the packet moves past the rule with no action taken. However, the counter for this rule is still increased by 1, as the packet matched the specified rule.  in our example we use DROP — The system that sent the packet is not notified of the failure. The packet is simply removed from the rule checking the chain and discarded.</p>

<p>This command will DROP connections from IP XXX.XXX.XXX.XXX on udp port 28960:28965</p>

<p>If you want to block all connections from a specific IP, no matter what port it tries to connect to, omit the -p -m and --dport parameters. This will look like this</p>

<pre spellcheck="false" tabindex="0">iptables -A INPUT -s XXX.XXX.XXX.XXX -j DROP
</pre>

<p>You might ask when are we going to loop thru the file?</p>

<pre spellcheck="false" tabindex="0">#!/bin/sh

# This will loop thru the file /ban/banip.txt and add every IP in that 
# file with a DROP to the INPUT chain in iptables.
#
# change the path and file name if required

# you can re-run this file if you are not saving your iptables config 
# between reboots. 
while read blist
do
/sbin/iptables -A INPUT -s $blist -j DROP &amp;&amp; sleep 2
echo $blist has been added to your iptables

done &lt; /ban/banip.txt
</pre>

<p>To add a single IP to the block list in iptables and add the IP to your text file, you could use a simple shell script like this</p>

<pre spellcheck="false" tabindex="0">#!/bin/sh
# Script to add ip
echo -n "Enter the IP to BAN and press [ENTER]:"
read ip
/sbin/iptables -A INPUT -s $ip -j DROP

#keep a record of the banned IP's if you want or comment out
echo $ip &gt;&gt; /ban/banip.txt
# Make sure you use the same path and filename as in the loop script
</pre>

<p>This is a quick and dirty way to keep a list of IPs you would like to block access from.</p>

<p>I'm sure that the readers have more sophisticated and innovative ways to add their own list of IPs to iptables.</p>

<p>Comment with how you do it and why you do it the way you do.</p>
]]>
        </description>
    </item>
   </channel>
</rss>
