[RESOLVED] PureFTP that send email notification on Upload
I am trying to piece together little snippets from all over the place to get this to work and I just cant get it to work.
What I want is a stand alone FTP server that sends an email to me when a file is uploaded.
I have started by building an Ubuntu 9.04 server as per Falkos:
up to step 10 and then adding postfix
Then installing Pure-FTP as per Falkos:
I then try to enable the pure-uploadscript by donig this (found on the net):
Run Pure-FTPd in standalone mode (not inetd mode).
Change the option "STANDALONE_OR_INETD" to "STANDALONE" in
Step 2: Tell Pure-FTPd the user ID under which the script should be run. Pure doesn't like usernames, so you have to provide the numeric UID. In case of www-data it is UID 33.
# if set, pure-uploadscript will spawn $UPLOADSCRIPT running as the # given uid and gid UPLOADUID=2001
Step 3: Tell pure-ftpd where the script is located: Change the option UPLOADSCRIPT in /etc/default/pure-ftpd.
# example: UPLOADSCRIPT=/usr/local/sbin/uploadhandler.pl UPLOADSCRIPT=/usr/local/sbin/uploadhandler.pl
Step 4: Enable the option itself:
echo "yes" > /etc/pure-ftpd/conf/CallUploadScript
Step 5: Start or Restart Pure-ftpd
And then I made my first ever shell script which went like this:
echo "$1 uploaded" | mail -s "New Upload : $1" email@example.com
but It doesn't work.
FTP Server part of things works fine.
The only function that the mailer side of this needs to be able to do is send me an email when a file is uploaded. It needs no incoming mailboxes or anything like that.
The Server is a FTP server and nothing else.
It sits in our office so it could even send me a message across the network if that is possible, but I use a windows machine(Windows 7) and a mac (OSX 10.4) as a pair of work stations.
If someone could show me a concise way of istalling Pure-FTP on an Ubuntu 9.04 server with upload notification, I would be very appreciative.
I am trying to learn about the linux world but I find man pages especially unhelpful for newbs and information on this topic, I have found particulary difficult to find.
I am about to start trying the snail program or ssmtp. As far as I can tell, these don't need a mail server installed on the system, they just use an external mail server and account. (It will also make me feel safer not having a mail server on the system to worry about being compromised. I don't know enough to make it secure.)
I am hoping that I can find an example of a script that uses one of these programs that will work for me or that I can some how work it out by gathering clues.
The Ultra Elusive pure-uploadscript(8)
I have now started again from scratch.
I have an Ubuntu 9.04 32-bit server as Falko's:
up to stage 10.
with a working Pure-ftpd server as per Falkos:
I then installed ssmtp:
sudo apt-get install ssmtp
sudo vi /etc/ssmtp/ssmtp.conf
ssmtp firstname.lastname@example.org and hitting enter, then
Subject: test email
and then crtl+D it successfully sends a mail via my gmail account.
This did not eaxctly help me.
I found another source that gave a small amount of help:http://blog.derjohn.de/space/start/2006-11-14/1
Step 6: Check if the daemon really run with the new options. (Doesn't say how)
Step 7: Create a test script. E.g. this one will write the filename to a file called /tmp/pure-was-here<datestamp>.
I tried that and uploaded a file but the file in /TEMP/ doesn't get created.
I have read the man page for pure-uploadscript over and over but it doesn't seem to tell me how to do anything, just what it can do.
I assume that what I need to do now is:
1). Learn how to create a shell script and then place it somewhere and tell the conf page where it is (UPLOADSCRIPT=)
2). Learn how to get said shell script to use ssmtp to send an email using the available things passed from uploadscript ($1 and others ???)
3). Prey that it works because if it doesn't I have no where to turn.
I feel I am so close now,
Any help that any kind soul could lend me would be greatly appreciated.
What are the outputs of
Thanks for looking at this for me.
The output of "which mail" is nothing.
The output of "which ssmtp" is:
When I started again from scratch, I built it with just the server and Pureftp, then installed ssmtp. Thats why "which mail" is empty.
Following your first advice
Thanks again for any help you can give me with this.
A little further
I have made a little more progress.
I have changed /etc/default/pure-ftpd-common to read
This is the userID of pureftpd.
I then made a script called /usr/sbin/upload2.sh which has the following code:
I then uploaded a file to the ftp server and went to /tmp and the file was there!! YAY!
So I made a txt file called /usr/sbin/msg1.txt which contains:
This however does not work.
If I move to the containing folder
and type ./upload1.sh
The email IS sent.
I feel I am very close now but it is still not working.
Using this script I found at http://www.axllent.org/docs/networki...on_the_console
The file home/www.example.com/ST15_01.pdf was uploaded ...
YAY double YAY
and thanks to axllent.org for the script
|All times are GMT +2. The time now is 10:18.|
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.