To restrict hard disk usage per user efficiently we could create a separate partition for each of the /home directories. However then it's obviously not so easy to change the granted space or add new users.
We therefore may use fixed sized images as a container for the users /home and mount these as loop devices (as root):
The route to take may be to limit the size of a user's home directory, i.e. limit /home/jake155 to a certain size. Typically a non-admin user cannot access anything beyond their home directory unless you change permissions otherwise. This thread discusses multiple ways to do that.
The standard way to do it in UNIX is through the
quota
command. It allows you to dynamically change how much disk space each user can use.See the man page, or google for a tutorial.
To restrict hard disk usage per user efficiently we could create a separate partition for each of the
/home
directories. However then it's obviously not so easy to change the granted space or add new users.We therefore may use fixed sized images as a container for the users
/home
and mount these as loop devices (as root):For testing:
After having done so we then create our user john123 who will now have 100 MB space available in his
/home/john123
.Subsequently the loop devices will have to be mounted prior to login, e.g. by adding this to
/etc/fstab
:The route to take may be to limit the size of a user's home directory, i.e. limit /home/jake155 to a certain size. Typically a non-admin user cannot access anything beyond their home directory unless you change permissions otherwise. This thread discusses multiple ways to do that.