Perform authentication in the LinuxShell Program

Source: Internet
Author: User

Source: http://www.hutuworm.org

I. Origin

A headache for Linux system administrators is that they do not know who accidentally runs a Shell program for a specific purpose on the premise that the system is not infiltrated, make the system messy. In addition, the system record shows that this person is using a public account (root or admin). You cannot know which one the person corresponds to in real life.

Ii. Opening

To address the preceding problems, the solution is as follows: first, tracking the time and ip address can track where the person came from based on the time and ip address. This solution can only identify a group of suspicious people headed by someone. If you all connect to the server through a proxy, there will be no better plans except one by one for log query. Second, record the log through authentication in the Shell program to clarify the responsibility.

Iii. Solution

This article uses the checkpassword tool compiled by Qmail author D. J. Bernstein for identity authentication.

1. Download:

Http://cr.yp.to/checkpwd/checkpassword-0.90.tar.gz

2. installation:

Tar xvfz checkpassword-0.90.tar.gz

Cd checkpassword-0.90

Make

Make setup check

3. If the checkpassword of the executable file does not appear in/bin, goto 1

In addition, the following program is complete:

--------------------------------

#! /Bin/sh

#

# Filename: auth. sh

# Author: huuworm

# @ Copyleft 2003 hutuworm.org

#

Function auth_failed (){

Echo "Are you kidding me? "

Exit 1

}

Echo "※※※※※※※※※※※"

Echo "※the pigsty is idle ※"

Echo "※※※※※※※※※※※"

Printf "Enter the account :"

Read ACCOUNT

If [$ ACCOUNT = admin-o $ ACCOUNT = root]

Then

Echo "admin & root are not welcome in this circle! "

Exit 1

Fi

Printf "enter the password :"

Stty-echo

Read PASSWORD

Stty echo

Echo ""

Printf "$ ACCOUNT $ PASSWORDY123456"/bin/checkpassword logger "$ ACCOUNT used auth. sh" 3 <& 0 auth_failed

Echo "welcome to the pig ring affiliated to the busi temple! : P"

--------------------------------

Iv. Acceptance

$ Chmod + x auth. sh

$

$./Auth. sh

※※※※※※※※※※※

※The pigsty is idle ※

※※※※※※※※※※※

Enter the account: huuworm

Enter the password:

Are you kidding me?

$

$./Auth. sh

※※※※※※※※※※※

※The pigsty is idle ※

※※※※※※※※※※※

Enter the account: admin

Enter the password:

Admin & root are not welcome in this circle!

$

$./Auth. sh

※※※※※※※※※※※

※The pigsty is idle ※

※※※※※※※※※※※

Enter the account: huuworm

Enter the password:

Welcome to the pig ring affiliated to the busi temple! : P

$

$ Tail-1/var/log/messages

May 5 13:51:45 huuworm.org May 5 13:51:45 logger: huuworm used auth. sh


 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.