Friday 28 February 2014

Step # 1: First get disk space:

$ df -H
Output:
Filesystem             Size   Used  Avail Use% Mounted on
/dev/hdb1               20G    14G   5.5G  71% /
tmpfs                  394M   4.1k   394M   1% /dev/shm
/dev/hdb5               29G    27G   654M  98% /nas/www

Step # 2: Next filter out filesystem and find out the percentage of space

$ df -H | grep -vE '^Filesystem|tmpfs|cdrom' | awk '{ print $5 " " $1 }'
Output:
71% /dev/hdb1
98% /dev/hdb5

Step # 3: Write a shell script

Above command displays field 5 and 1 of df command. Now all you need to do is write a script to see if the percentage of space is >= 90% (download script):
#!/bin/sh
df -H | grep -vE '^Filesystem|tmpfs|cdrom' | awk '{ print $5 " " $1 }' | while read output;
do
  echo $output
  usep=$(echo $output | awk '{ print $1}' | cut -d'%' -f1  )
  partition=$(echo $output | awk '{ print $2 }' )
  if [ $usep -ge 90 ]; then
    echo "Running out of space \"$partition ($usep%)\" on $(hostname) as on $(date)" |
     mail -s "Alert: Almost out of disk space $usep%" you@somewhere.com
  fi
done

Setup Cron job

Save and install script as cronjob. Copy script to /etc/cron.daily/ (script downolad link)
# cp diskAlert /etc/cron.daily/
# chmod +x /etc/cron.daily/diskAlert

OR install as cronjob:
crontab -e
Write cronjob as per your requirement
10 0 * * * /path/to/diskAlert

Updated script version

Tony contributed and updated my script - You can exclude selected filesystem in case you don't want monitor all filesystems.
#!/bin/sh
# set -x
# Shell script to monitor or watch the disk space
# It will send an email to $ADMIN, if the (free available) percentage of space is >= 90%.
# -------------------------------------------------------------------------
# Set admin email so that you can get email.
ADMIN="root"
# set alert level 90% is default
ALERT=90
# Exclude list of unwanted monitoring, if several partions then use "|" to separate the partitions.
# An example: EXCLUDE_LIST="/dev/hdd1|/dev/hdc5"
EXCLUDE_LIST="/auto/ripper"
#
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
#
function main_prog() {
while read output;
do
#echo $output
  usep=$(echo $output | awk '{ print $1}' | cut -d'%' -f1)
  partition=$(echo $output | awk '{print $2}')
  if [ $usep -ge $ALERT ] ; then
     echo "Running out of space \"$partition ($usep%)\" on server $(hostname), $(date)" | \
     mail -s "Alert: Almost out of disk space $usep%" $ADMIN
  fi
done
}
if [ "$EXCLUDE_LIST" != "" ] ; then
  df -H | grep -vE "^Filesystem|tmpfs|cdrom|${EXCLUDE_LIST}" | awk '{print $5 " " $6}' | main_prog
else
  df -H | grep -vE "^Filesystem|tmpfs|cdrom" | awk '{print $5 " " $6}' | main_prog
fi

Wednesday 19 February 2014

So First Step is Boot in to Recovery Mode:

ubuntu password

You will see the following screen. Now select "root - Drop to root shell prompt" and press "Ok"


Ubuntu reset password

Here is video tutorial

If you forgot your username enter this command to know:




In linux case is sensitive about username and password, If you have upper case than you need to enter same letters.
Mount root with following command:




Now Enter following command to reset your password:




For example (See the picture above):




Now enter your new password and confirm it.
Reboot pc:




That's it.

Sumber


  • 1) Login to Horde
  • 2) Select the mail folder from the left-hand menu
  • 3) Push the options button located in the top menu
  • 4) Click the Fetch Mail link
  • 5) Click the Edit your preferences for accessing other mail accounts link
  • 6) Click the Create a New Account button
  • 7) Pick IMAP/POP3 Mail Servers from the Mail server type drop-down
  • 8) Enter the account name you wish to use
  • 9) Select the protocol you wish to use (contact your old host for this information).
In most situations IMAP (Auto Detect Protocols) or POP3 (Auto Detect Protocols) will work fine. We recommend that you try to use IMAP if possible.

  • 10) Enter the username and password for the account you are copying your emails from.
     
  • 11) Enter the server host-name for the old host. (contact your old host for this information)
     
  • 12) Enter the Remote Mailbox (folder) that contains the emails you wish to move. In most situations, you can simply input Inbox
     
  • 13) Select the local mailbox (folder) you wish to put the moved emails.
  • 14) Click create/save
  • 15) Click the Fetch Mail button located in the top menu
  • 16)  Check the corresponding boxes next to the account(s) you wish to import
  • 17)  Click the Fetch Mail button
  • 18) That’s it! You have now imported all the emails located in the mailbox you picked in step 12 from your old host.
By Under: CentOS, Fedora, Linux Distros, Open Source, RedHat On: July 14, 2012
Download Your Free eBooks NOW - 10 Free Linux eBooks for Administrators
Guys, if you are a regular reader of tecmint.com you will notice that this is our third article on security tools. In our previous both articles we have given you all the guidance in how to secure Apache and Linux Systems from Malware, DOS and DDOS attacks using mod_security and mod_evasive and LMD (Linux Malware Detect). Again we are here to introduce a new security tool called Rkhunter. This article will guide you a way to install and configure RKH (RootKit Hunter) in RHEL 6.3/6.2/6.1/6/5.8, CentOS 6.3/6.2/6.1/6/5.8 and Fedora 12,13,14,15,16,17 systems using source code.
Install Rkhunter in Linux

Install Rkhunter in Linux

What Is Rkhunter?

Rkhunter (Rootkit Hunter) is an open source Unix/Linux based scanner tool for Linux systems released under GPL that scans backdoors, rootkits and local exploits on your systems. It scans hidden files, wrong permissions set on binaries, suspicious strings in kernel etc. To know more about Rkhunter and its features visit http://www.rootkit.nl/.
Install Linux Rkhunter (Rootkit Hunter) in RHEL 6.3/6.2/6.1/6/5.8, CentOS 6.3/6.2/6.1/6/5.8 and Fedora 12,13,14,15,16,17

Installing Rkhunter (Rootkit Hunter) in RHEL, CentOS and Fedora

Step 1: Downloading Rkhunter

First download the latest stable version of Rkhunter tool by going to http://www.rootkit.nl/projects/rootkit_hunter.html or use below Wget command to download it on your systems.
# cd /tmp
# wget http://ncu.dl.sourceforge.net/project/rkhunter/rkhunter/1.4.0/rkhunter-1.4.0.tar.gz

Step 2: Installing Rkhunter

Once you have downloaded the latest version, run the following commands as a root user to install it.
# tar -xvf rkhunter-1.4.0.tar.gz
# cd rkhunter-1.4.0
# ./installer.sh --layout default --install

Step 3: Updating Rkhunter

Run the RKH updater to fill the database properties by running the following command.
# /usr/local/bin/rkhunter --update
# /usr/local/bin/rkhunter --propupd

Step 4: Setting Cronjob and Email Alerts

Create a file called rkhunter.sh under /etc/cron.daily/, which then scans your file system every day and sends email notifications to your email id. Create following file with the help of your favourite editor.
# vi /etc/cron.daily/rkhunter.sh
Add the following lines of code to it and replace “YourServerNameHere” with your “Server Name” and “your@email.com” with your “Email Id“.
#!/bin/sh
(
/usr/local/bin/rkhunter --versioncheck
/usr/local/bin/rkhunter --update
/usr/local/bin/rkhunter --cronjob --report-warnings-only
) | /bin/mail -s 'rkhunter Daily Run (PutYourServerNameHere)' your@email.com
Set execute permission on the file.
# chmod 755 /etc/cron.daily/rkhunter.sh

Step 5: Manual Scan and Usage

To scan the entire file system, run the Rkhunter as a root user.
# rkhunter --check
The above command generates log file under /var/log/rkhunter.log with the checks results made by Rkhunter. For more information and options please run the following command.
# rkhunter --help
If you liked this article, then sharing is the right way to say thanks.


Sumber
Instal rkhunter dari Source


Karena repositori Ubuntu memiliki versi lama dari rkhunter yang berisi bug unpatched, kita akan menginstal dari source sehingga program berjalan dengan baik.


Ubah ke direktori home Anda dan men-download file. Pada tulisan ini, 1.4.0 adalah versi terbaru, tetapi Anda bisa pergi ke halaman rumah proyek untuk melihat apakah versi yang lebih baru tersedia:


cd
wget http://downloads.sourceforge.net/project/rkhunter/rkhunter/1.4.0/rkhunter-1.4.0.tar.gz

Setelah itu telah selesai di-download, ekstrak file dan masuk ke direktori yang dihasilkan:

tar xzvf rkhunter*
cd rkhunter* 


setelah kita masuk ke dalam subfolder tersebut baru lah kita install

sudo ./installer.sh --layout /usr --install

setelah menginstall kita perlu mengupdate repositori agar utilities berjalan semua fungsi nya

sudo apt-get update
sudo apt-get install binutils libreadline5 libruby1.8 ruby ruby1.8 ssl-cert unhide.rb mailutils

Anda akan ditanya beberapa pertanyaan tentang setup server mail. Anda dapat mengkonfigurasi ini jika Anda ingin, tapi untuk singkatnya, kita tidak akan mengkonfigurasi web server menghadap mail. Pilih "hanya lokal" untuk mengikuti contoh kita. 

Jika Anda menginstal secara lokal, Anda dapat nama apapun sistem email. Jika tidak, pastikan untuk menggunakan nama domain berkualifikasi lengkap. 

Sekarang, perangkat lunak kami terinstal dan siap untuk pengujian dan konfigurasi


Hal pertama yang harus kita lakukan adalah memastikan bahwa versi rkhunter kami adalah up-to-date.

sudo rkhunter --versioncheck

[ Rootkit Hunter version 1.4.0 ]

Checking rkhunter version...
  This version  : 1.4.0
  Latest version: 1.4.0

 
Selanjutnya, kita perlu melakukan pilihan yang sama untuk memperbarui file
File-file ini berisi informasi yang rkhunter pemeriksaan terhadap untuk menentukan apakah sebuah file atau perilaku yang mencurigakan atau tidak


sudo rkhunter --update


Dengan file database kami yang update
kita dapat mengatur properti file awal kami sehingga rkhunter yang dapat mengingatkan kami jika ada dari konfigurasi penting file itu yang berubah. Kita perlu memberitahu rkhunter untuk memeriksa nilai-nilai saat ini dan menyimpannya sebagai nilai-nilai yang dikenal-baik:

sudo rkhunter --propupd
File created: searched for 167 files, found 136

kita siap untuk menjalakan rkhunter, untuk mengecek semua file, apakah ada peringatan untuk perilaku mencurigakan

sudo rkhunter -c --enable all --disable none

untuk melihat peringatkan bisa melihat di log rkhunter

sudo nano /var/log/rkhunter.log


Sumber