MYSYSAD.COM

Limit User's File Size -- UNIX

· Files & disks · Users & security

If you are hurting for disk space, you might want to look into limiting the file size a user can create. Depending on the shell, you can do this by using either limit or ulimit command -- add to a user's initialization file to make permanent. Here are a few examples.

# sh
# ulimit -f 5000
# mkfile 6m MB
File Size Limit Exceeded - core dumped

# ksh
# ulimit -f 5000
# mkfile 6m MB
File Size Limit Exceeded(coredump)

# csh
# limit filesize 5m
# mkfile 6m MB
File Size Limit Exceeded (core dumped)

# bash
# ulimit -f 5000
# mkfile 6m MB
File Size Limit Exceeded (core dumped)