I am creating a self-control tool for administrators. The script when run by an administrator, would voluntarily drop admin privileges. The administrator can regain admin privileges by running the script again but faces an intentional delay (of say 20 min).
What would be a good way to do this?
Let's say the administrator is called
my-admin. My current solution is the following:
- Add a file in
my-adminto run a script called
- The script
/usr/local/bin/delayed-admindoes the following: If
my-adminis a part of the
admingroup, it removes it from the group. And if
my-adminis not in the
admingroup then it sleeps for 20min and then adds it to the
This seems to work, but I don't like the idea of messing with the sudoer file every time.