[SUMMARY] Change 60 users quota !

From: Osama Ahmed <osama_at_myrealbox.com>
Date: Sun Aug 18 2002 - 13:58:28 EDT
My Original post is below.

Thanks to:
 - Tim Evans
 - Chris L. Anderson
 - Mark Ryan
 - James Fairbairn
 - John E Riddoch
 - Nico Wieland


No way, you have to script ! 

The Solution would be to create a serious of prototype users(each
prototype with a different quota and then write a loop)

Here are the sample scripts:
======Tim===============================================================
=====
Create a prototype user quota file,  then:

for USER in `ls /export/home`
do edquota -p protouser $USER
Done
======Chris=============================================================
=======
/bin/ksh
for x in `fgrep "/export/home" /etc/passwd | awk -F':' '{print $1}'`
<return>
do <return>
edquota -t $x {rest of command}  <return>
done <return>
========James===========================================================
=======
for user in `ls /export/home | sed -e 's/\///g'` ; do
  edquota -p templateuser $user
done

Or if you want to choose the users affected, list the usernames in a
file
("users_list"), separated by newlines:

for user in `cat users_list` ; do
  edquota -p templateuser $user
done
=======Mark=============================================================
======
 First make a series of prototype user accounts.  I used to have
password accounts called grads, faculty, ugrads, staff, and, managers.
I set the correct quota for each of these template accounts and disabled
them so that no one could log in using them.  I used to change the
quotes using the "-p" option to edquota.  For example here is what I
did:

argus> cd /home/grads
argus> foreach f (*)
foreach? edquota -p grads $f
foreach? echo "Changing quota for user $f"
foreach? end

This would create a loop until all the users under "/home/grads" had
their quotas changed to the "grads" template.  I later wrote a script to
parse the password file for users and groups and then set the
appropriate quota.
===========Mark Perl Script=========================================
#!/usr/local/bin/perl

while (($name,$passwd,$uid,$gid,$quota,$comment,
	$gcos,$dir,$shell)=getpwent) {
    if ( $gid == 4938 ) {
	print "edquota -p itstaff $name\n";
    }
    if ( $gid == 4267 ) {
	print "edquota -p graduate $name\n";
    }
    if ( $gid == 4269 ) {
	print "edquota -p ugrad $name\n";
    }
    if ( $gid == 4270 ) {
	print "edquota -p faculty $name\n";
    }
    if ( $gid == 9530 ) {
	print "edquota -p bustaff $name\n";
    }
    if ( $gid == 4851 ) {
	print "edquota -p guest $name\n";
    }
    if ( $gid == 43904 ) {
	print "edquota -p collab $name\n";
    }
    if ( $gid == 4939 ) {
	print "edquota -p scv $name\n";
    }
    if ( $gid == 3617 ) {
	print "edquota -p gc $name\n";
    }
    if ( $gid == 43819 ) {
	print "edquota -p postdoc $name\n";
    }
    if ( $gid == 43816 ) {
	print "edquota -p spclpgm $name\n";
    }
    if ( $gid == 43818 ) {
	print "edquota -p external $name\n";
    }
    if ( $gid == 14023 ) {
	print "edquota -p cs420 $name\n";
    }
    if ( $gid == 8351 ) {
	print "edquota -p cs786 $name\n";
    }
    if ( $gid == 15134 ) {
	print "edquota -p cs893 $name\n";
    }
    if ( $gid == 17581 ) {
	print "edquota -p ek521 $name\n";
    }
    if ( $gid == 8882 ) {
	print "edquota -p sc713 $name\n";
    }
    if ( $gid == 27479 ) {
	print "edquota -p ch551 $name\n";
    }
    if ( $gid == 17578 ) {
	print "edquota -p ch751 $name\n";
    }
    if ( $gid == 17582 ) {
	print "edquota -p py421 $name\n";
    }
}

========================================================================
====

Thanks a lot guys. This list is the best.

Osama Ahmed


-----Original Message-----
From: sunmanagers-admin@sunmanagers.org
[mailto:sunmanagers-admin@sunmanagers.org] On Behalf Of Osama Ahmed
Sent: Monday, August 12, 2002 10:52 PM
To: sunmanagers@sunmanagers.org
Subject: Change 60 users quota !


Hi,
I have /export/home file system with 60 user directories. I want to
change the quota of "All" users once at a time ! 
For the edquota command you have to type a user name after the command
which means repeating the command 60 times !

edquota -t will copy the "same" quota for all users on a filesystem
which I did not want because each user got his own quota ! (Quota is not
the same for all users !)

Any Solution ?

will summarize.
PS:I am using Solaris 2.6 with latest recommended patch cluster.

Osama Ahmed
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers
Received on Sun Aug 18 13:01:49 2002

This archive was generated by hypermail 2.1.8 : Thu Mar 03 2016 - 06:42:52 EST