Source

 

To Enable and disable services across runlevels in Debian, Ubuntu, and other Debian based Linux distributions we use a script called update-rc.d

How to enable a service


As an example, to enable Apache web server in Debian, do the following –

# update-rc.d apache2 defaults


… this will enable the Apache web server to start in the default run levels of 2,3,4 and 5. Of course, you can do it explicitly by giving the run levels instead of the defaults keyword as follows:

# update-rc.d apache2 start 20 2 3 4 5 . stop 80 0 1 6 .


The above command modifies the sym-links in the respective /etc/rcX.d directories to start or stop the service in the destined runlevels. Here X stands for a value of 0 to 6 depending on the runlevel. One thing to note here is the dot (.) which is used to terminate the set which is important. Also 20 and 80 are the sequence codes which decides in what order of precedence the scripts in the /etc/init.d/ directory should be started or stopped.

To enable the service only in runlevel 5, you do this instead –

# update-rc.d apache2  start 20 5 . stop 80 0 1 2 3 4 6 .

 

How to disable a service


To disable the service in all the run levels, you execute the command:

# update-rc.d -f apache2 remove


Here -f option which stands for force is mandatory.

Useful IPtables commands

Link

Link

 

iptables -A INPUT -s IP ADDRESS -j LOG –log-prefix “iptables:  ”

iptables -A INPUT -s IP ADDRESS -j DROP

iptables -i eth1 -A INPUT -s 10.0.0.0/8 -j LOG –log-prefix “iptables:”

/sbin/iptables -I INPUT -s {IP-HERE} -j DROP
/sbin/iptables -I INPUT -s 1.2.3.4 -j DROP

How Do I Delete Blocked IP Address?
iptables -L INPUT -n –line-numbers
iptables -D INPUT 3

Continue Reading

How to use “Tail” Command

Have you ever needed to look at the last entries in a log file.

Of course you have.

For example you want to see the last errors in the /var/logs/mail.log file

If you open it with NANO or some other txt editing programme you will have to scroll all the way to the bottom.

AND if more entries are logged while you are already in the file you will not see them!

This is a pain

Continue Reading