I have a computer (Mac) that is authorized to play music through iTunes which I want to disable. But, I only have ssh access to the machine. Is there an applescript I can run remotely (eg via the terminal) that I can use to de-authorize the machine?
I know that I can unauthorize all the machines I have authorized, but I would prefer to use this solution if it is possible.
I don’t see any properties to authorize/deauthorize in iTunes dictionary but I just played around with GUI scripting and came up with a solution. So, the target Mac will have to have GUI Scripting enabled for the script below to work.
You could leave that AppleScipt on your target Mac and then just use the open command to launch it. Or you could copy the above AppleScript and paste it into a shell script and use the HEREDOC method with osascript.
The full example of this looks like this:
The above method works well with Apple Remote Desktop’s Send Unix feature as well.
Also, note that the password is included in this script which I don’t recommend
but it is needed on the deauthorize window. If you put the password in the script make sure to secure that script so no one gets ahold of your Apple password.