It is currently Wed May 23, 2018 12:34 pm

script for vsftpd -- on disconnect hide files or move files

All times are UTC - 6 hours

Post new topic Reply to topic  [ 2 posts ] 
Author Message
 PostPosted: Sat Apr 21, 2007 5:20 pm   

Joined: Sat Apr 21, 2007 4:50 pm
Posts: 1
Hello everyone,

I'm new here as u can see. I'm from Belgium and i apologize for my language if it's not correctly spelled.
Now, I'll scetch my situation.
For my end terms in school i have to set up a project with an ftp site in debian (vsftpd)
On that ftp there are multiple accounts. One of them is ACCOUNTNAME : help PASSWORD :help
For example: I did a redirect (html) which came out on the ftp site where someone can enter this account and upload data to.
The purpose is to aid that person when they have problems... The webmaster pulles the stuff of the ftp site and everything is empty again.

A. When the account "help" logs in he can upload data for example "data.rar" --> OK, no problem it works
B. He reconnects --> OK, but data is stll visible and he cant upload (may NOT overwrite) the same data!

I need to put a script in crontab (checks ever 10 min or less?) which checks a certain file like vsftpd.log where in stands that "help" disconnected from the site and uploaded a file. Then these files need to be hidden and renamed to something else so the same person "help" can reconnect and upload the same file again if neccesary.

Let's recap:::
A. Check a certain file on disconnect and/or upload from "help"
B. Rename those files and hide them from ftp user ( OR move them to another dir? )

I would appreciate if someone can help me with this script.
Thx in advance

 PostPosted: Tue Apr 24, 2007 1:46 pm   
Site Admin
User avatar

Joined: Sun May 15, 2005 9:36 pm
Posts: 693
Location: Des Moines, Iowa
Well a cron job to move the files and rename every 10 minutes would be very easy.

timestamp="$(date +%m.%d.%Y_%H.%M.%S_)"
cd /path/to/
     for i in *.*
         mv /path/to/* /newpath/to/${timestamp}${i}

This would take a file located /path/to/
and would move it to /newpath/to/
and would rename it to something like.


The first set of digits being the date. .. the next set being the Hour/Min/Seconds .... the last part being the original filename being moved.

I didn't run it, but it should work..... just change the /path/to and /newpath/to parts......

 Profile WWW  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours

Who is online

Users browsing this forum: Google [Bot] and 7 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  

BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group