advfs quotas

From: Rodney Simioni (rodneys@lodging.com)
Date: Wed Oct 02 2002 - 14:38:34 EDT


Original Question:THANKS to ALL; overall, edquota command is not
interactive, will need to write script.

I have parsed out my huge /etc/passwd file so that I have a file containing
the usernames. Now, I want to use the edquota
command so that I can set advfs quotas. The advfs manual did not indicate
setting quotas on a file containing usernames was possible. Can Advfs allow
me to set quotas on a file containing user names? I'm trying to avoid
setting quotas on many individual users separately or groups.

TIA
Rod
================================================

Replies:
simon.g.millard
Create a quota for a user - we'll call him default_user.

Then do this:

for i in `cat listofnames`
do
        edquota -p default_user -u $i
===============================================

you could do something like
awk '{system("edquota -p proto_user -u " $1)}' userfile
this runs the edquota on each user in the userfile and copies proto_user's
settings to the user.
This assumes that userfile is a file with one username per line.

-charlie
===============================================
How about scripting it. As the edquota man page says, set 1 user and
use that user as the template. Then set all the users in a simple
shell loop like this:

for i in `cat parsedusersfrompasswd` ; do edquota -t templateuser $i ;
done

Short and sweet.

--
Jay R. Wren
===============================================
Nothing in the "edquota" reference page implies that it doesn't
expect to be interactive, but I suspect that if you made your
editor be "cat" and used the "apply a prototype allocation to
the named user" variation, you could write a script to run it
all for you.  I'd try it on a few test cases first.
Tom
===============================================
If your usernames are in a file called "usernames", you can:
	#ksh
	#cat usernames |while read newuser; do /usr/sbin/edquota -p prueba
$newuser;done
	So the quota of "prueba" user (a user you had created before and
has quota) is copied to all the users you have in your file "usernames".
Jo
===============================================
Not exactly what you want, but I've done something similar...  On our
system, any given user's quota is dependent upon what group they're in.
So I created a prototype user for each group; dummy IDs with no real
login.  Once the prototypes are set up, it's relatively easy to change a
bunch of users or create new users using the prototype:
vedquota -p prototype -u user
This does not pop you into an editor to change values, it just makes
everything the same as the prototype user!  Put that in a script loop, and
you can do your entire userbase in a relatively short time!
                                                          Pablo


This archive was generated by hypermail 2.1.7 : Sat Apr 12 2008 - 10:48:55 EDT