在 Apple 遙距桌面中使用 kickstart 指令列工具程式
不需重新啟動遠端電腦,即可使用 kickstart 來執行 Apple 遙距桌面指令。
使用 kickstart 以設定 Apple 遙距桌面偏好設定。例如,你可以安裝、解除安裝、啟用、設定和重新啟動 Apple 遙距桌面的組件。
了解如何在 macOS Mojave 10.14 或之後版本中使用 kickstart 指令列工具程式,以螢幕共享控制遙距 Mac。
開始使用
你可以在以下位置找到 kickstart 工具:
/系統/資源庫/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart
請以一行文字的形式輸入這篇文章中的指令。如果在你輸入時文字自動換行沒有問題。在輸入完完整的指令之前,請勿按下 Return 鍵。
如需更多關於使用 kickstart 指令的資料,請使用 -help 旗標:
sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -help
範例指令
這篇文章中的指令可與 Apple 遙距桌面 3.2 和以上版本配合使用。
以下是你可用來進行相關操作的指令:
重新啟動 ARD 代理程式和輔助程式:
sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -restart -agent
開啟「遙距桌面分享」、允許所有用戶存取並啟用額外選單:
sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -activate -configure -allowAccessFor -allUsers -privs -all -clientopts -setmenuextra -menuextra yes
開啟「遙距桌面分享」並允許指定用戶存取:
sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -activate -configure -allowAccessFor -specifiedUsers
You must use the -configure, -access, and -privs options in a separate command to specify the set of users and their access privileges. For example, this command is for users with the short names "teacher" and “student." It gives them access to observe (but not control) the computer, and to send text messages:sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -configure -users teacher,student -access -on -privs -ControlObserve -ObserveOnly -TextMessages
Unlike other kickstart options, you can’t combine the allowAccessFor options with other kickstart options. You must use it as in the last two samples above. You might have to call kickstart more than once to finish a computer’s setup.移除指定用戶 (本例中的「學生」) 的存取權限:
sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -configure -users student -access -off
停用 ARD 代理程式並移除所有用戶的存取權限:
sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -deactivate -configure -access -off