How do I apply controls to an admin account?

Asked by Mathieu D. Morissette

I know this seems at first to defeat the purpose, but hear me out...

Since I have a bit of a computer addiction problem, my dad wants a way to regulate the way I spend time on the computer. Back before I switched to Linux, we used a parental control program called 'ComputerTime.' It allowed me to set controls on all accounts, including the Administrator account.

However, there are few parental control programs for Linux, and I can't find any that allow limiting any accounts that have administrator privileges. This is a problem, because I need admin for a good percentage of things I do on this computer. I know that it would make it incredibly easy to circumvent Timekpr, but the parental control program is only there as a reminder anyway, and there is a mutual trust in place that I can have admin, and I won't circumvent anything in place.

If I cannot find a suitable parental control program for Linux, my dad is demanding I switch back to Windows. So it's either I find a way to get this to work with Admin privileges, I forfeit Admin, or I... Well, you know the third option, and none of us want that.

So, if you won't implement the ability to limit accounts that are under the Admin group, can I myself at least have some help getting Timekpr working under these circumstances, even if it requires modifying the program itself?

Thank you
Mathieu M.

Question information

English Edit question
timekpr Edit question
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Even Nedberg (nedberg) said :

I have not tested this but it _should_ work:


Around line 67-71 you will find:

#Check if it is a regular user, with userid within UID_MIN and UID_MAX.
def isnormal(username):
    #FIXME: Hide active user - bug #286529
    if (getenv('SUDO_USER') and username == getenv('SUDO_USER')):
        return False

Change the last line into
        return True

Please give feedback if this works! I am unsure how the green/red padlock will behave and if you will get any notifications. Beware that you might lock yourself out from the computer! If you do: Log into safe mode and do

rm /var/lib/timekpr/<your-username>.*

Revision history for this message
Savvas Radevic (medigeek) said :

If you prefer to have SELF-limitation over the computer usage, there is a gnome applet called: workrave
Install from ubuntu software center, right-click on a gnome panel > Add > Workrave (I think)

..or you could create a new user with limited sudo access.
- your dad => keeps admin account and admin privileges
- you => keep the new user with limited sudo privileges, i.e. disable access to run timekpr-gui / timekpr
That is possible if you edit the /etc/sudoers:
EDITOR=nano sudo visudo

Some sudoers examples:

Can you help with this problem?

Provide an answer of your own, or ask Mathieu D. Morissette for more information if necessary.

To post a message you must log in.