Category Archives: Linux

Administration FreeBSD Linux Tips and Tricks

Setting files as immutable.

Wouldn’t it be nice if we can set files so that even root cannot modify or delete it ? Both FreeBSD and Linux come with commands that allows us to set files as immutable. If you have files that you don’t want anyone to modify/delete by mistake, then these commands are quite useful.   FreeBSD …

Administration CentOS Fedora Linux

Disable SELinux

Security-Enhanced Linux (SELinux) is a mandatory access control (MAC) security mechanism implemented in the Linux kernel. This mechanism adds an extra layer of access security to your files,directories,devices, ports and even processes. I strongly recommend that you implement SELinux in your environment. But, in some cases, you may want to disable it to avoid some …

Administration FreeBSD Linux Security

Scanning for rootkits and possible exploits – RKHunter

Rootkits are malicious softwares that are installed by intruders to gain access to your server once the security of the server has been breached.  Intruders can leave some malicious softwares or back doors in your server to gain permanent access to your server after it has been compromised. Rootkit Hunter (RKHunter) is a Unix-based tool …

Administration Linux

Disk Benchmarking Tools.

One of the main bottlenecks in server slowness is the Disk IO. If the speed of your disks are slow, then the CPUs of your servers may be wasting their CPU cycles waiting for IO operation to be completed. You may have enough CPU and memory, but if the Disk IO operation is slow, still you will …

FreeBSD Linux Tips and Tricks

How to get rid of ^M characters.

When you edit a file in Windows and then open in UNIX, you must have seen ^M characters getting appended in the content. How to get rid of it ? Most UNIX OS come with a utility called ‘dos2unix or dosunix (FreeBSD)’ . If it is not installed, please run following appropriate commands to install …

Linux

Simple Stateful Load Balancer with iptables and NAT

NOTE: To demonstrate how iptables can perform network address translation this how-to shows how to use it to implement a over-simplified load balancer. In practice we would use a daemon such as HAProxy allowing IP tables to check packets before forwarding them. Using the method presented in this tutorial packets get forwarded without going through …

Linux Security

Denial Of Service: iptables Defense

Servers sometimes get hit with what are know as DOS attacks. The offending IP address is usually readily available in the logs for the server being hit. If your SSH server is being hit with a bruteforce DOS the easiest thing to do is block the IP using iptables like so: # iptables -A INPUT …

Linux Security

Patching The Ghost Vulnerability

The Ghost vulnerability, also known as CVE-2015-0235, is an exploit in a library named glibc. This library is referenced by many applications which run on your server. The exploit is a bug which affects 2 pieces of code which are used to do a DNS lookup, which translates a hostname to an IP address. A …

FreeBSD Linux

Extract Tar Files to a Different Directory

Syntax Typical Unix tar syntax: tar -xf file.name.tar -C /path/to/directory GNU/tar syntax: tar xf file.tar -C /path/to/directory tar xf file.tar –directory /path/to/directory Example: Extract files to another directory In this example, I’m extracting $HOME/etc.backup.tar file to a directory called /tmp/data. First, you have to create the directory manually, enter:   mkdir /tmp/data To extract a …

Linux

Vi Commands 101

Cursor movement h – move left j – move down k – move up l – move right w – jump by start of words (punctuation considered words) W – jump by words (spaces separate words) e – jump to end of words (punctuation considered words) E – jump to end of words (no punctuation) …