July 2013
M T W T F S S
1234567
891011121314
15161718192021
22232425262728
293031  

Categories

July 2013
M T W T F S S
1234567
891011121314
15161718192021
22232425262728
293031  

Automatic Users Logout After a Period of Inactivity

* For SH/BASH/TCSH

Below script will implement a 5 minute idle time-out for the default /bin/bash shell.

Step 1: Create file autologut.sh

# vi /etc/profile.d/autologout.sh

Add New

Append the following code:

TMOUT=300

readonly TMOUT

export TMOUT

Step 2: Save and close the file. Set permissions:

# chmod +x /etc/profile.d/autologout.sh

 

*For tcsh version follow the […]

Duplicating a disk

If you have two IDE drives that are of identical size, and provided that you are sure they contain no bad sectors and provided neither are mounted, you can run

dd if=/dev/hda of=/dev/hdb

To copy the entire disk and avoid having to install an operating system from scratch. It doesn’t matter what is on the […]

How to Use MD5 Sum

Full Name : Message-Digest algorithm 5

Usage : Using an MD5 checksum you can verify the integrity of data

Algorithm : cryptographic hash function with a 128-bit value

MD5 sum first identify the the data which is backup and then create a MD5 checksum which is combination of unique string of letters and numbers put […]

Remove Blank lines from file

sed ‘/./!d’ filename.txt > temp1.txt

sed ‘/^$/d’ filename.txt > temp1.txt

grep -v ‘^$’ filename.txt > temp1.txt

Disable Users to login into the server

Suppose we want to take a backup of user’s account. So for that first of all we have to block the user to login into their account to maintain data integrity of user’s backup files. So using below technique we can do that very easily.enjoy !!!

Edit the pam file located in /etc/pam.d/ directory for […]

Time bases iptables rules

f you want to restrict/allow access to certain service on timely basis using iptables.

Use : iptables patch-o-matic extension (pom or p-o-m)

That allows us to match a packet based on its arrival or departure timestamp.

Syntax : iptables RULE -m time –timestart TIME –timestop TIME –days DAYS -j ACTION

–timestart TIME: Time start value […]

Split the Large files

Split on a 300mb example.zip file:

#split -b 100mb example.zip

It will generate 3 files with the following file sizes:

100MB xaa 100MB xab 100MB xac

After split use: cat to combine a file

#cat xa* > example-new.zip

Block brute force attacks using denyhost

ssue:

Check your /var/log/auth.log file. In this file you can able to see that some unauthorized user is constantly trying to access your system using brute force attacks. He/she trying to get the access of your system by some scripts which is trying to login with different password. We can block this using simple iptables […]