本文章已经归档,因此 Apple 将不再对其进行更新。

在“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 -specifiedUsersYou 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 -TextMessagesUnlike 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.

  • 移除特定用户(在以下示例中为“student”)的访问权限:

    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

发布日期: