Hi All,
Is anyone aware of how to turn remote login on and off via an applescript. I cannot seem to find any infomaiton via Google.
Thanks
Hi All,
Is anyone aware of how to turn remote login on and off via an applescript. I cannot seem to find any infomaiton via Google.
Thanks
Unfortunately, I haven’t recorded the author of this script which isn’t mine, but I suspect you can modify it to suit your requirement:
on script_version()
return "1.0"
end script_version
on script_description()
return "Shuts off file sharing when location is not 'Home'."
end script_description
on prediction(|type|, prediction)
if |type| is equal to "Location" then
tell application "System Preferences"
activate
set current pane to pane "com.apple.preferences.sharing"
end tell
tell application "System Events"
tell process "System Preferences"
set theRow to item 1 of (rows of table 1 of scroll area 1 of group 1 of window "Sharing" whose value of static text 1 is "Web Sharing")
if (value of checkbox 1 of theRow) is equal to 0 and prediction is equal to "Home" then
click checkbox 1 of theRow
else if (value of checkbox 1 of theRow) is equal to 1 and prediction is not equal to "Home" then
click checkbox 1 of theRow
end if
end tell
end tell
tell application "System Preferences"
quit
end tell
end if
end prediction
prediction("Location", "Argo")
or via launchd
remoteLogin("load") -- enable
remoteLogin("unload") -- disable
on remoteLogin(value)
do shell script "launchctl " & value & " -w /System/Library/LaunchDaemons/ssh.plist" with administrator privileges
end remoteLogin
Thanks Both!
AS soon as i get home i wil add this into my code and have a good play arround.