LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-02-2011, 02:59 PM   #1
jwilliams
LQ Newbie
 
Registered: Sep 2010
Location: Northern California
Distribution: Ubuntu 9.1, Debian
Posts: 4

Rep: Reputation: 0
Help with setting up vsftp user permissions and chron job to del files periodically


Hi first time poster here.
I have a Fedora fc10 system with a working installation of vsftpd I have setup a new user "pub" and want the ftp user to be able to put and get files but preferably not delete files from the "pub" directory though delete is not critical as I also want to set up a chron job to wipe the directory of stale files weekly. Unix/Linux administration is not one of my strong suits but I'm a pretty good googler.

So far all is working but the chron job that's where I need the help.
delete *.* from /home/pub weekly

Thanks,
John
 
Old 06-03-2011, 12:22 AM   #2
rayfordj
Member
 
Registered: Feb 2008
Location: Texas
Distribution: Fedora, RHEL, CentOS
Posts: 488

Rep: Reputation: 78
Do you want to delete all files weekly or delete files older than one week?

If 'delete weekly', you could remove stale files that were _just_ uploaded before your rm cronjob runs.

cron /home/pub/ rm example: /etc/cron.weekly/rm-home-pub
Code:
#!/bin/bash
# may need recursive (-r) option depending on configuration
if [ -d "/home/pub" ]; then
   /bin/rm -f /home/pub/*
fi
If deleting files older than one week, you could run this daily or whatever suits your preference and/or needs.

cron /home/pub/ tmpwatch example: /etc/cron.daily/rm-home-pub
Code:
#!/bin/bash
flags=-umc
# depending on requirements, might want distinction of atime, ctime, or mtime
if [ -d "/home/pub" ]; then
   /usr/sbin/tmpwatch ${flags} -f 7d /home/pub/
fi

 
Old 06-03-2011, 02:53 PM   #3
jwilliams
LQ Newbie
 
Registered: Sep 2010
Location: Northern California
Distribution: Ubuntu 9.1, Debian
Posts: 4

Original Poster
Rep: Reputation: 0
Hi Rayford,

Thanks for the reply and code. I like the latter choice checking daily for files > a week. I'll give that a try.

Thanks again,
John

Quote:
Originally Posted by rayfordj View Post
Do you want to delete all files weekly or delete files older than one week?

If 'delete weekly', you could remove stale files that were _just_ uploaded before your rm cronjob runs.

cron /home/pub/ rm example: /etc/cron.weekly/rm-home-pub
Code:
#!/bin/bash
# may need recursive (-r) option depending on configuration
if [ -d "/home/pub" ]; then
   /bin/rm -f /home/pub/*
fi
If deleting files older than one week, you could run this daily or whatever suits your preference and/or needs.

cron /home/pub/ tmpwatch example: /etc/cron.daily/rm-home-pub
Code:
#!/bin/bash
flags=-umc
# depending on requirements, might want distinction of atime, ctime, or mtime
if [ -d "/home/pub" ]; then
   /usr/sbin/tmpwatch ${flags} -f 7d /home/pub/
fi

 
Old 06-03-2011, 05:18 PM   #4
jwilliams
LQ Newbie
 
Registered: Sep 2010
Location: Northern California
Distribution: Ubuntu 9.1, Debian
Posts: 4

Original Poster
Rep: Reputation: 0
Hi Rayford,

Thanks for the reply and code. I like the latter choice checking daily for files > a week. I'll give that a try.

Thanks again,
John

Quote:
Originally Posted by rayfordj View Post
Do you want to delete all files weekly or delete files older than one week?

If 'delete weekly', you could remove stale files that were _just_ uploaded before your rm cronjob runs.

cron /home/pub/ rm example: /etc/cron.weekly/rm-home-pub
Code:
#!/bin/bash
# may need recursive (-r) option depending on configuration
if [ -d "/home/pub" ]; then
   /bin/rm -f /home/pub/*
fi
If deleting files older than one week, you could run this daily or whatever suits your preference and/or needs.

cron /home/pub/ tmpwatch example: /etc/cron.daily/rm-home-pub
Code:
#!/bin/bash
flags=-umc
# depending on requirements, might want distinction of atime, ctime, or mtime
if [ -d "/home/pub" ]; then
   /usr/sbin/tmpwatch ${flags} -f 7d /home/pub/
fi

 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] VSFTP: chrooted virtual user ignores file system permissions gospodin.horoshiy Linux - Server 2 06-07-2010 02:41 PM
Setting User Permissions macgyver007 Linux - Newbie 3 04-12-2005 11:21 AM
chron job locks redhat 9 up. jbg Linux - Software 1 08-19-2004 10:32 AM
vsFTP user permissions scriptkiddie Linux - General 0 06-29-2004 09:14 AM
vsftp user hiden files intruder Linux - Software 1 12-21-2003 04:18 PM


All times are GMT -5. The time now is 05:57 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration