Logo Background RSS

» Linux

  • Get an email When Google Crawls Your Site
    By on February 25th, 2009 | 7 Comments7 Comments Comments

    Hi friends here is the php code to know whenever google crawl your website.
    it automatically sends you an email on your email id.

    < ?php
    if ( strpos( $_SERVER['HTTP_USER_AGENT'], ‘Googlebot’ ) !== false )
    {
    // Your email address
    $email_address = ‘you@yourdomain.com’;
    // Send yourself an email
    mail($email_address,’Googlebot Alert’, ‘The Googlebot has visited your page: ‘.$_SERVER['REQUEST_URI']);
    }
    ?>

    If you have any query feel free to contact me

  • Modify ssh Welcome message
    By on February 9th, 2009 | 1 Comment1 Comment Comments

    Hi friends if you want to create a ssh login message for your server if any buddy login with ssh they will get a welcome message.
    Lets Start Login with root password

    pico /etc/motd

    You will get a welcome screen you can modify it anything you want to show to your users. who logged via ssh. Write something like this
    This computerized system is designed for registered users. All activity is recorded and investigated by the individual system regularly. Those without power or more than their rights when using this system to cancel all its services are subject to. Any illegal services or the user of the server or attempt to withdraw their services in the conduct of local law enforcement to notify the user of law will be finalized and will be punished. Anyone using this system consents to these terms.

    Now type Ctrl+X then hit Y and enter

    now your welcome message is now saved

    Logout of SSH then log back in, you’ll see your new greeting.. :D

  • Get Email when someone Login by root
    By on February 9th, 2009 | 2 Comments2 Comments Comments

    Hi friends everybuddy wanted security about their webserver and updated everytime
    you can get an email when anybuddy login via root though ssh.

    To accomplish this you will need to edit the file .bash_profile.
    At command prompt type the below command:

    pico .bash_profile

    At the end of the file add following code:

    echo ‘ALERT – Root Access from:’ `date` `who` | mail -s “Alert: Root Access from `who | awk ‘{print $6}’`” admin@gmail.com

    Replace this with your email “admin@gmail.com”

    If  anybuddy login via ssh root  then you will recieve an email.

  • check ram size in Linux
    By on February 4th, 2009 | 1 Comment1 Comment Comments

    you can use this command to find the ram size in your linux machine

    free

    Mem is Ram size in bytes. Use -m option for output in MB.
    SWAP is the size of SWAP partition.

    free -m

    Looks like you’re using up a lot of memory. Top displays your memory usage a little better as far as the “easy to read” factor goes.

    top

  • Install mod_security through WHM
    By on February 1st, 2009 | 4 Comments4 Comments Comments

    Background:
    Mod_Security is an open source intrusion detection and prevention engine for web applications. Operating as an Apache Web server module, the purpose of Mod_Security is to increase web application security, protecting web applications from known and unknown attacks.

    Official web site: http://www.modsecurity.org

    More information:
    1. Log to your Web Host Manager via your favorite web browser.

    2. On the left frame, scroll all the way down till you have reached the cPanel section, then click on Addon Modules.

    3. A new window will appear on the right frame. Scroll down until you see modsecurity, check the Install and Keep Updated field, and click on Save.

    cPanel will now begin to download Mod_Security and add a basic security scheme. Mod_Security will be added to Apache configuration file which is located at /usr/local/apache/conf/, and will include its main security configuration file which can be found at /usr/local/apache/conf/modsec.conf

    That’s it. mod_security is now installed on your server. Now, all that is left for you to do is to edit and add security filters.

    You can edit Mod_Security as configuration file either through Web Host Manager, or from shell (SSH).

    Web Host Manager
    Once the installation has been completed, a new section will be added to WHM by the name of Add-ons. Scroll down on the left frame until you see it, and click on the Mod Security link.

    Note: If you are still logged to your WHM and don’t see the Add-ons section, try refreshing your browser.

    Shell
    cPanel includes three configuration files: modsec.conf, modsec.user.conf, and modsec.user.conf.default.

    The ones that are in effect are modsec.conf, and modsec.user.conf. The file modsec.user.conf is blank by default, however, modsec.user.conf.default contains common security filters which can be applied to modsec.user.conf.

    I recommend viewing modsec.user.conf.default before copying, and applying any security filters. Misconfiguration can do more harm than good.

    Hope you all like this post :D

  • Zip file via ssh
    By on February 1st, 2009 | 2 Comments2 Comments Comments

    How many of you know how to zip a file by ssh

    # zip -r example.zip www
    
    This zips all files and directories
    • -r:Includes all files and directories -> Files
    • example.zip:The zip file you want to create
    • www : The folder you are targetting or use * if your currently in the folder.

    Comments are invited! :)