Register
It is currently Thu Jul 31, 2014 11:35 am

Req: Home dir size quota script


All times are UTC - 6 hours


Post new topic Reply to topic  [ 2 posts ] 
Author Message
 PostPosted: Sat Mar 03, 2007 4:23 pm   

Joined: Sat Feb 10, 2007 4:22 pm
Posts: 1
Hey Everyone,

I'm fairly new to writing bash scripts, but I'm trying to put together a script to run on startup to limit the size of a users home directory.

Conceptually this is what I have:

"

if a user tries to write to their home dir

then it checks the total size of the home dir
if it is under 100mb it changes the permissions to read/write/execute
if it is over 100mb then it changes the owners permissions to read/execute only

"


It seems like it would work in theory, but I need a bit of help to actually write the script. I'm not looking for someone to write it for me, but if someone could give me some hints on how to determine is a user is writing something to the directory and how to set the dir size as a variable.


Many Thanks in advance!!


Top
 Profile  
 PostPosted: Sat Mar 03, 2007 9:27 pm   
Site Admin
User avatar

Joined: Sun May 15, 2005 9:36 pm
Posts: 664
Location: Des Moines, Iowa
Code:
du -sh /home/*/

This will check the size of all the users home directories.

Note: I would run this as a cron job that checks size ever 10 minutes or so........

A cron job as root would have access to all the user directories and would be able to change permissions on those that are over the limit. Checking every 10 mins or so would allow a user to correct the overage and it would automatically reset itself if the user deleted some files and went below the limit.

man chmod would give you the information you need to reset the directory permissions.


Top
 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: Bing [Bot], Google [Bot] and 4 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:  
cron


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP