This question already has an answer here:

I need to restrict the use of a machine to two hours per day (total, across multiple sessions of being physically logged in at the console). Is there any way I can do that?

Edit: I suppose I could do something with pam_exec, but before I go that route and accidentally lock myself out of my machine (like I did with my Pi :( )....

merged by Oli Mar 21 '16 at 13:15

This question was merged with How do I restrict my kids' computing time? because it is an exact duplicate of that question.