1820595 Members
1254 Online
109626 Solutions
New Discussion юеВ

Update user quota limit

 
SOLVED
Go to solution
peterchu
Super Advisor

Update user quota limit

we have 350 users in the system , now I want to set the size quota limit for all users , each user will allow 5M hard and 10M soft quota limit , I know it can update by the command "edquota" , could suggest what is the convenience way to update all users except run 350 times of edquota ? thx .
11 REPLIES 11
Rajeev  Shukla
Honored Contributor

Re: Update user quota limit

Hi,

I would suggest to edit the quota for one user and then duplicate using a script to all the rest 349 users. ( That is only 2 commands)

Cheers
Rajeev
peterchu
Super Advisor

Re: Update user quota limit

thx reply , could suggest which file should be duplicate ? thx
Ravi_8
Honored Contributor

Re: Update user quota limit

Hi

cat /etc/passwd |awk -F: '{print $1}' > /tmp/users

for i in 'cat /tmp/users'
do
edquota $i
done

read the manual pages of edquota (man edquota) before performing this opeartion
never give up
Robert-Jan Goossens
Honored Contributor

Re: Update user quota limit

Hi Perterchu,

Should it not be 5 MB softlimit and 10 MB hardlimit ?

A user will get a warning as the softlimit is reached.

Hope this helps,
Robert-Jan
peterchu
Super Advisor

Re: Update user quota limit

thx reply ,

I hv generated a file called /tmp/users
#vi /tmp/users
user1
user2

then run the script

for i in 'cat /tmp/users'
do
edquota $i
done

but it report the error :

edquota: User cat doesn't exist.

could suggest what is wrong , thx in advance.
Robert-Jan Goossens
Honored Contributor
Solution

Re: Update user quota limit

# cat /tmp/users | while read LINE
do
edquota $LINE
done
peterchu
Super Advisor

Re: Update user quota limit

thx goo's reply ,

I tried your method , but still have problem , after run the script , it pop the error below , could suggest what is wrong ? thx

"/var/tmp/EdP.a24823" 1 line, 75 characters
how


~
ks (soft = 100000, hard = 100000) inodes (soft = 0, hard = 0)
~
~
~
~
~

Input read error
Yogeeraj_1
Honored Contributor

Re: Update user quota limit

hi,

in your script above, you should use:
for i in `cat /tmp/users`

instead of:
for i in 'cat /tmp/users'

regards
Yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
peterchu
Super Advisor

Re: Update user quota limit

your script is right, i can run edquota for each user , but I also need to edit 350 times the user quota files , can I just edit one file and then duplicate it to all users ? thx.
Ranjith_5
Honored Contributor

Re: Update user quota limit

Hi Peter,

can you try the following?

cat /etc/passwd |awk -F: '{print $1}' > /tmp/quota

for i in `cat /tmp/quota`
do
edquota -p $i
done


regards,
Syam
peterchu
Super Advisor

Re: Update user quota limit

it is OK , thx