I'm running a few linux desktops; mainly for kids (yeah, trying to teach them the right OS at early stage) (running Ubuntu 10.10, Gnome)

The problem is that they found very funny to make their workstations (actually, old 512 Mb pentium 4) by launching thousands of firefox instances.

I'm looking for a way to restrict them to launch 'N' instances of a particular application. Haven't figured yet how. Thought of a monitoring daemon but I think that would be too ressources hungry.

Any idea of a script/trick to achieve this ?

Note: i might have 1-2 level of users (the kids, and the more grown up kids) so i have also to limit per user; something like user1: 3firefox, user2: 2firefox instances.


It seems like your issue is that too many programs are able to be launched, not that there are too many of one app or another. For that, you might want to look into better process limiting/throttling so that they can't crash the machine that way.

As far as prevention with specific apps: When dealing with kids, what I would do is look into making shortcuts that open the current running instance of an app if there is one already open, and opens another only if there isn't. Or simply don't work if there's already a running instance.

You can make shortcuts that use a command from the command line instead of whatever they're currently doing. I can't recommend a specific command syntax that just doesn't work if there's already an instance running, but that's where I would start looking.


Look into adding some process count limits into your limits.conf file, usually located at /etc/security/limits.conf.

The following snippet will limit members of the users group to 200 processes:

@users          hard    nproc   200

This won't let you limit users to a certain number of any particular application, but it will go a long way towards protecting the rest of the machine from a few malicious users.

You might also want to consider using address space limits instead of strict process count limits.

The following will impose a hard limit of 512000KB (500MB):

@users          hard    as      512000

For firefox specifically, part of the problem is that no matter what you do to the shortcut, the kid can get dozens and dozens of firefox windows by hitting ctrl-N. Also, as far as I know (Debian stable's iceweasel) when you attempt to run a second copy of firefox without the -no-remote commandline option, it sends a message to the existing firefox to open a new window, then exits, so there's normally only one firefox process (per user). You might try out this window limiter addon, which may help you since you're using it for its intended purpose instead of trying to block popups like the angry reviewers.

For other applications in general, most docks capture the application icon within the dock itself and clicking on the application in the dock again returns you to the existing window (see OSX, or how Windows 7 behaves for applications pinned to the taskbar). Most can still open multiple copies of the application if you right click, but this might fool small enough kids for a while. You just need to find a dock with an application launcher that works this way and works with Gnome, which will probably take a little trial and error.

  • If they know the hotkey shortcut for opening new windows, they know enough to let them do what they want. – Kzqai Mar 1 '11 at 17:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.