How to Disable Screensaver for New User – plist and Defaults Method

defaultsplistscreensaver

I am fairly new to OS X, I am trying to disable the screensaver of a user that I recently created with the following commands on the terminal of an account that I'm currently logged in as:

    sudo dscl . create /Users/NewUser

    # More commands are run after this one, but skipping to the important part...

    sudo defaults write /Users/NewUser/Library/Preferences/ByHost/com.apple.screensaver.MAC_UUID.plist idleTime 0

However this doesn't seem to be working. I've noticed that when you create a new user, there is no screensaver plist that exists until the user actually logins.
I am not too familiar with plists and Apple in general, any help would be greatly appreciated!

Best Answer

Have you tried running it as the other user using:

sudo -u NewUser defaults write /Users/NewUser/Library/Preferences/ByHost/com.apple.screensaver.MAC_UUID.plist idleTime 0

The command I found for setting the screensaver to never start was:

sudo -u NewUser defaults -currentHost write com.apple.screensaver idleTime 0