Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
* setquota
@ 1997-10-03  4:00 PC7 root user
  1997-10-04  4:00 ` setquota Jay Hennessey
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: PC7 root user @ 1997-10-03  4:00 UTC (permalink / raw)



Is there an easy way to set user quota from the shell
or from a C or Perl program? Something like setquota(users, MB)? 
Any hints greatly appreciated*

Regards from Vienna
Johann Mitloehner
mitloehn@wu-wien.ac.at
http://www.wu-wien.ac.at/usr/ai/mitloehn




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: setquota
  1997-10-03  4:00 setquota PC7 root user
@ 1997-10-04  4:00 ` Jay Hennessey
  1997-10-05  4:00 ` setquota PC7 root user
       [not found] ` <343C83B7.A464D936@kudonet.com>
  2 siblings, 0 replies; 4+ messages in thread
From: Jay Hennessey @ 1997-10-04  4:00 UTC (permalink / raw)



The standard way to edit quotas is the edquota command.

You can also create one user using edquota, then copy that user's settings
to other users (it's a flag to edquota..see the man page)

I'm not sure of the system calls off the top of my head.
-Jay

In article <612dpd$mpa@cantine.wu-wien.ac.at>, mitloehn@miss.wu-wien.ac.at
(PC7 root user) wrote:

>Is there an easy way to set user quota from the shell
>or from a C or Perl program? Something like setquota(users, MB)? 
>Any hints greatly appreciated*
>
>Regards from Vienna
>Johann Mitloehner
>mitloehn@wu-wien.ac.at
>http://www.wu-wien.ac.at/usr/ai/mitloehn

-- 
"Jesus loves you more than you will know. Wo wo wo. wo wo wo."
                                        -Simon and Garfunkle
Jay Hennessey <henn@spam_me_not.bigfoot.com>
For a good time: http://www.kluge.net/~jay/
Although this user is sober, he takes no responsability for what
was written.
My statements are not representative of any other entity



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: setquota
  1997-10-03  4:00 setquota PC7 root user
  1997-10-04  4:00 ` setquota Jay Hennessey
@ 1997-10-05  4:00 ` PC7 root user
       [not found] ` <343C83B7.A464D936@kudonet.com>
  2 siblings, 0 replies; 4+ messages in thread
From: PC7 root user @ 1997-10-05  4:00 UTC (permalink / raw)



PC7 root user (mitloehn@miss.wu-wien.ac.at) wrote:
: Is there an easy way to set user quota from the shell
: or from a C or Perl program? Something like setquota(users, MB)? 
: Any hints greatly appreciated*

I have done some C programming, here is what I came up with, thought
others might be interested. The quotactl() function is the key.
Thanks for responses!

Regards from Vienna
Johann Mitloehner
mitloehn@wu-wien.ac.at
http://www.wu-wien.ac.at/usr/ai/mitloehn


#include <ufs/quota.h>
#include <pwd.h>
#include <ufs/quota.h>

main(int argc, char *argv[]) {
  char us[256], fs[256];
  int uid, cmd;
  u_int kbyte;
  struct passwd *pw_ent;
  struct dqblk dq;

  if (argc != 4) {
    printf("Usage: %s user filesys\n", argv[0]);
    exit(-1);
  }
  strcpy(us, argv[1]);
  strcpy(fs, argv[2]);
  kbyte = atoi(argv[3]);
  pw_ent = getpwnam(us);
  uid = pw_ent->pw_uid;
  
  cmd = QCMD(Q_GETQUOTA, USRQUOTA);
  quotactl(fs, cmd, uid, &dq);
  dq.dqb_bhardlimit = kbyte * 2;
  cmd = QCMD(Q_SETQUOTA, USRQUOTA);
  quotactl(fs, cmd, uid, &dq);
}



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: setquota
       [not found] ` <343C83B7.A464D936@kudonet.com>
@ 1997-10-09  4:00   ` Seppo Routimo
  0 siblings, 0 replies; 4+ messages in thread
From: Seppo Routimo @ 1997-10-09  4:00 UTC (permalink / raw)



In article <343C83B7.A464D936@kudonet.com>, Patrick Mendoza <jvc411@kudonet.com> writes:
> PC7 root user wrote:
> 
>> Is there an easy way to set user quota from the shell
>> or from a C or Perl program? Something like setquota(users, MB)?
>> Any hints greatly appreciated*
>>
>> Regards from Vienna
>> Johann Mitloehner
>> mitloehn@wu-wien.ac.at
>> http://www.wu-wien.ac.at/usr/ai/mitloehn
> 
>>
> As root:
> 
> # cp /dev/null /home/quotas
> # chmod 600 /home/quotas
> # chown root /home/quotas
> 
> Editing users' quotas individually:
> 
> #edquota (user)
> 
> The -p option to set quotas for multiple users:
> 
> #edquota -p (user) (user) (user)
> 
> Hope this helps.  :-)
> 
> -Patrick
> 
> http://home.kudonet.com/~jvc411/welcome.html
> 

Hi

For some strange reason our quota,edquota etc. don't show anything.
Instead I use vquota, vedquota...
Anyway here's how I did it. (If it is of any use to you)

- First vedquota xxx as a proto-user
- Then cd to the directory where all our users' home-directories are.
  Just tried vedquota -pxxx -u * (our usernames and home-directory names
  are the same) and it really copied the proto quotas to the usernames.

SR



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1997-10-09  4:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1997-10-03  4:00 setquota PC7 root user
1997-10-04  4:00 ` setquota Jay Hennessey
1997-10-05  4:00 ` setquota PC7 root user
     [not found] ` <343C83B7.A464D936@kudonet.com>
1997-10-09  4:00   ` setquota Seppo Routimo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox