Monitor all vsftp actions and send an email to notify shell scripts

Source: Internet
Author: User

Wget http://cloud.github.com/downloads/rvoicilas/inotify-tools/inotify-tools-3.14.tar.gz

Wget http://caspian.dotconf.net/menu/Software/SendEmail/sendEmail-v1.56.tar.gz

Wget http://inotify.aiken.cz/download/incron/incron-0.5.9.tar.bz2

Tar zxvf inotify-tools-3.14.tar.gz
Cd inotify-tools-3.14
./Configure
Make
Make install
Man inotify test whether the installation is successful

Tar xvf incron-0.5.9.tar.bz2
Cd incron-0.5.9
Make
Make install

Tar xvf sendEmail-v1.56.tar.gz
Music sendEmail-v1.56 sendEmail

Vi/etc/vsftpd. conf

Add at the end:
Dual_log_enable = YES
Use_localtime = YES
Vsftpd_log_file =/var/log/vsftpd. log

In touch/var/log/vsftpd. log

The above operation is to generate the vsftpd log File vsftpd. log

Service vsftpd restart #### restart a service ####

Vi/home/shell/ftp. sh

#! /Bin/bash
/Home/shell/sendEmail-f XXX @ XXX-t XXX @ XXX-s smtp. XXX-u "who logged on to my FTP server:"-xu user-xp passwd-m time: 'Tail-1/var/log/vsftpd. log | awk '{print $1, $2, $3, $4, $5} ''### user and IP: 'Tail-1/var/log/vsftpd. log | awk '{print $8, $12} ''### action: 'Tail-1/var/log/vsftpd. log | awk '{print $10} ''###, Come in Target: 'Tail-1/var/log/vsftpd. log | awk '{print $13, $14 }''


# Incrond ### start the monitoring tool ###

# Incrontab-e

/Var/log/vsftpd. log IN_MODIFY sh/home/shell/ftp. sh

### Here is a brief description of incrond ####


Incron is the cron system of inotify. Like cron of system itself, it contains an incrond and an incrontab ), unlike the cron of the system itself, the operation on folders or files is not the operation on time.

######################################## ###############################

Create an FTP user

Useradd test

Paaswd test

Test: Use test to log on:

Email Alert:


When you use teset to create a folder and rename it:


Email Alert:



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.