Solved

User Quota's

Posted on 2001-06-07
21
350 Views
Last Modified: 2013-12-16
I wish to setup user/group quotas on my system. Can I do this so that any new user that is created is automatically given the same quota as all existing users. This must be automatic upon creation of new users accts. All users will be members of the same group. By setting quota.group on the users home directory root -> ie /home will this be sufficient? Or would I need to place it in /etc/skel . Or could I use something like /etc/skel and quota.$user ?
0
Comment
Question by:j1mlondon
  • 11
  • 9
21 Comments
 
LVL 2

Expert Comment

by:olidel
ID: 6171379
Hi,

You can find some information about quota in this Mini HOW_TO :

http://www.linuxdoc.org/HOWTO/mini/Quota.html

0
 
LVL 3

Accepted Solution

by:
jnbkze earned 150 total points
ID: 6186256
Hi,

Your first issue is to check that your Kernel support quotas. Almost all of the new ones do, by default, so you'll probably be OK in this regard.

Next make sure you have the quota software installed. If it's not, download and install it. You should be able to get it either from your Linux Distributions website or from www.freshmeat.net

Next you should modify you init scripts so that it turns quota's on at boot time. Here's an example script (note this script is not my own, but it does work)# Check quota and then turn quota on.
if [ -x /usr/sbin/quotacheck ]
        then
               echo "Checking quotas. This may take some time."
               /usr/sbin/quotacheck -avug
               echo " Done."
        fi
         if [ -x /usr/sbin/quotaon ]
        then
                echo "Turning on quota."
                /usr/sbin/quotaon -avug
        fi

Now you should edit your fstab and add usrquota next to the mount option if you want to enforce user specific quota's or you can choose to enforce group quota's by using grpquota instead. You can even have usrquota and grpquota together as options for your mount point

Next, create your quota record files.
Example: you will be implementing quota's on /home
so you do the following:

touch /home/quota.user
touch /home/quota.group
chmod 600 /home/quota.user /home/quota.group

Now you can reboot, and quotas should be enabled for the file systems that you have set it up for.

Now you can go about enforcing quota's for your users.
You use the command edquota -u username

example: edquota -u jnbkze
This opens vi (or which ever editor is in your $EDITOR environment variable)

You then edit the hard and soft value and then save the file.

If you need more info on the hard and soft values then, look at the howto that was mentioned above.


0
 

Author Comment

by:j1mlondon
ID: 6190184
Yes, my kernel does support quotas. I have gone through the howto but whenever I turn the quota's on I get an error like ' Can't access blah blah.. device or resource busy'
I have created a separate partition with the users home dir.s and put quota.group in the root of that. Modified /etc/fstab for quota.group
Used edquota for the group and then tried to use quotacheck but this gives nothing. Then if use quotaon I get the error message.
0
 
LVL 3

Expert Comment

by:jnbkze
ID: 6190408
could you please cut and paste the error message, so I can see what it says exactly. Thanks
0
 

Author Comment

by:j1mlondon
ID: 6190445
Sure here it is....
# quotaon -a
quotaon: using /quota.group on /dev/hda*: Device or resource busy
quotaon: using /homes/quota.group on /dev/hda*: Device or resource busy


0
 
LVL 3

Expert Comment

by:jnbkze
ID: 6190455
Have you tried unmounting and then remounting the partitions?
0
 

Author Comment

by:j1mlondon
ID: 6190462
No...why?
0
 
LVL 3

Expert Comment

by:jnbkze
ID: 6190479
It "shouldn't" be a problem but I've seen it happen before when trying to enable the quota's that, after editing my fstab, I had to unmount, and then remount my file systems.
Give it a try, it can't hurt.
0
 

Author Comment

by:j1mlondon
ID: 6190650
Ok will do. It seems to have worked...:o)
If I create a new user FRED who is a memeber of the group WEBcreators and I use quota.group for the group WEBcreators. Will FRED's home be quota'd?
0
 
LVL 3

Expert Comment

by:jnbkze
ID: 6190737
his home will be quota'd only if the WEBcreators group is the group owner of his home dir. If not, then he will not be restricted
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 

Author Comment

by:j1mlondon
ID: 6190764
B******s!
So if he owns the content but is a member of the group WEBcreators the quota'ing won't apply?


Ok...in that case this won't work how I need it to. I am using the users home dir.s as there websites and need to quota them. So can you suggest a way of automating the process when the user acct is created. I really don't want to have to manually add user.group and vi it for approx. 200-300 users.
0
 
LVL 3

Expert Comment

by:jnbkze
ID: 6190937
his home will be quota'd only if the WEBcreators group is the group owner of his home dir. If not, then he will not be restricted
0
 
LVL 3

Expert Comment

by:jnbkze
ID: 6190980
look:
If his home dir is group owned by webcreators and his GID (in the passwd file) is webcreators then yes, the group quota's WILL work.
If he is a member of webcreators but his GID in the passwd file is "users" then unless he does a newgroup command to be in the webcreators group, the group quota's for webcreators won't apply.
Quota's should be able to do what you're looking for. It's just a case of managing the group, and setting the ownerships of dir and files correctly
0
 

Author Comment

by:j1mlondon
ID: 6191034
I see..I think...thanks for your time.( I will increase the points as I have diversified a bit).
Does this mean though that anyone who is a member of the group will be able to change his website...which I don't want.
0
 
LVL 3

Expert Comment

by:jnbkze
ID: 6191205
Let same you have 2 users

user1 and user2
Both these users are in the group webcreators
Each user can still set the permissions on their files that on the user NOT the group can edit those file. BUT at the same time, because they are both in the webcreators group, the quota's applied to the group will apply to the both of them.

If you wanted to give them different amounts of space, eg user1 only gets 10 megs and user2 get 20 megs then you could create groups called webcreator10 and webcreator20 and then you would put each user in whichever group you want so that the correct quota's get applied. This is slightly more admin, but still far less than doing on a "per user quota system"

Am I still on track with what you're looking for? Let me know.
0
 

Author Comment

by:j1mlondon
ID: 6191270
Yes totally. So I must make the gid equal to the group WEBcreators when I create the user, or chgrp for the /home/$user after creating...to WEBcreators, along those lines....and if the quota.group file is in place already then it will apply.
I'm not actually implementing now...working on something else at the present moment. Will try it out tomorrow. Do you mind if I keep the thread open until tomorrow night in case of any problems with it?Increased to 150
0
 
LVL 3

Expert Comment

by:jnbkze
ID: 6191311
OK - I see you've got the idea now. Glad I could have helped. I'll wait to see your comments tomorrow night. Have fun.
0
 

Author Comment

by:j1mlondon
ID: 6191353
Great- thanks a lot
:o)
0
 
LVL 3

Expert Comment

by:jnbkze
ID: 6195533
Have you looked at the quota thing today at all? If you have no futher questions, please could you close the thread. Thanks.
0
 

Author Comment

by:j1mlondon
ID: 6195552
Sorry I haven't had time yet today....here's the points though and thanks for the help.
Jim
0
 
LVL 3

Expert Comment

by:jnbkze
ID: 6201104
Thanks Jim,
You need to accept one of my comments as an answer though otherwise the question does not get a closed status. Thanks!
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

rdate is a Linux command and the network time protocol for immediate date and time setup from another machine. The clocks are synchronized by entering rdate with the -s switch (command without switch just checks the time but does not set anything). …
Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now