3

I have it setup so that my son only has 1 hour of computer use per day. He commonly needs extensions, and I think the only solution to do it while I am away is through terminal. Is there a way to extend the remaining time via a terminal command? Please note that I am only looking at answers through terminal not other 3rd party software.

Thanks.

3

You can change /Library/Managed\ Preferences/Username/com.apple.familycontrols.timelimits.v2.plist under the key time-limits there are 2 dictionaries you may need to consider :

  • weekday-allowance

  • weekend-allowance

Both have a key "secondsPerDay" you may change.

You may edit the .plist by converting it to XML using sudo plutil -convert xml1 theFile and then edit it with your favourite command line editor.

2

You can also change the setting with PlistBuddy:

sudo /usr/libexec/PlistBuddy -c 'set time-limits:weekday-allowance:secondsPerDay 10800' /Library/Managed\ Preferences/test/com.apple.familycontrols.timelimits.v2.plist

Replace test with the username.

When I tried using fast user switching to log in on a test account, switching back to my main account, and setting the limit to a few seconds, I wasn't able to log back in on the test account. I don't know if the changes are applied immediately if the account is in use though.

  • Hmm, appears sometimes the timelimits file is setup with slightly different structure than what's listed here (mine doesn't have a weekday-allowance key, but lists the days separately, so this particular command didn't work). Converting to xml and editing the file manually worked though. – rogerdpack Dec 20 '13 at 16:54
  • Unfortunately it appears that this file is auto re-generated at login time, so modifications only affect the current session. Anybody know a workaround out there? – rogerdpack Dec 27 '13 at 16:20
0

From http://blog.takelap.com/2010/05/how-to-set-mac-os-x-parental-controls.html

If you want a script to "do it all for you"

create a script (file) like "limit.sh"

#!/bin/sh

# Force times to a lower value than the usual default.

# 15 minutes
TVAL=900
USER=user
/usr/bin/dscl . mcxexport /Users/$USER -o /tmp/usertimes$$.exp \
    com.apple.familycontrols.timelimits limits-list
awk -v TVAL=$TVAL 'BEGIN { flag=0 }
                   /timeLimitSeconds/ { flag=1;print;next } 
                   flag == 1 { $1="<integer>" TVAL "</integer>"; flag=0}
                   {print}' < /tmp/usertimes$$.exp > /tmp/usertimesnew$$.exp
/usr/bin/dscl . mcximport /Users/$USER /tmp/usertimesnew$$.exp
/bin/rm -f /tmp/usertimes$$.exp /tmp/usertimesnew$$.exp

then $ chmod u+x limit.sh

and run it with sudo.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .