Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Possible Duplicate:
How can I set computer usage time limits?

I've looked at a number of other threads but most of them talk about how to restrict the time of day an account can log in... What I'm looking for is a simple way to restrict the total usage minutes during any 24-period, e.g. I want to allow "jsmith" to be logged in a total of 120 minutes per day. I don't necessarily care WHEN jsmith is logged in; I just want to cap his total time at 120 minutes during the 24 hour period 0000-2400.

I looked at the question, "How do I restrict my kids' computing time" but again that focuses on WHEN the account can actually log in, not how LONG the account is allowed to remain logged in.

The solution needs to "remember" previous logins even after the user has logged out; for example if jsmith logs in for an hour in the morning, then logs out, jsmith should not be allowed to remain logged in for more than an hour in the afternoon or evening, for a total of 2 hours usage per 24-hour period. What is the easiest way to accomplish this in Ubuntu 11.04?

share|improve this question

marked as duplicate by Nitin Venkatesh, James Feb 28 '12 at 17:39

This question was marked as an exact duplicate of an existing question.

If you open a terminal and type w, then you can see who are logged on and when they logged on. If they logged in more than an hour ago, then you suspend the account and log off the user. You would preferably use the notify-send command to notify the user before logging off.

I don't know any applications that does exactly this, but it should be easy to make one, I think.

share|improve this answer
w won't sum up the total time when a user logs out and in again. – Takkat Nov 16 '11 at 20:43
It will if you store it and add it up. – Jo-Erlend Schinstad Nov 16 '11 at 21:00

As long as you are on 11.04 you can use timekpr, that also allows to restrict the computing time of a user within a 24h range.

Alternatively, only available in Ubuntu <= 11.04 is the command line tool timoutd Install timoutd that allows such time restrictions.

Sadly, both tools do not work any more in 11.10.

share|improve this answer
At least timekpr has packages for 11.10. – Jo-Erlend Schinstad Nov 16 '11 at 21:02
They don't work – Takkat Nov 16 '11 at 21:11

In has been instructed how to make timekpr to function in 11.10. Works at least for me.

share|improve this answer
A link to a bug report is only minimally useful. Could you include in your answer the steps needed to workaround the bug? – Flimm Nov 12 '12 at 15:26

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