Sending Unix Commands
Apple Remote Desktop includes a Send Unix Commands feature. This feature enables you to send command-line instructions to a single computer or multiple computers at one time. The feature is somewhat different from using SSH for remote command-line management in a few ways.
First, with SSH, a connection must be made to the remote computer, and commands must be sent interactively, which effectively limits you to working with one computer at a time. Remote Desktop does not require you to log in and establish separate interactive SSH connections to each computer. This means you can more easily send commands and you can also send them to many computers at once. Access to SSH requires that Remote Login be enabled on the remote computers, which can reduce system security. Remote Desktop does not require you to enable Remote Login or SSH to send Unix commands and it limits the users who can send commands to those with the appropriate Remote Desktop privileges. Another difference is that you can send multiple commands in a single batch, which are then executed one after the other, without you needing to wait for individual commands to be executed.
The flip side of these differences is that although you can issue Unix commands through Remote Desktop, they are not issued interactively. You can choose to view the results of commands after they are sent. However, this is not the same experience as establishing an interactive SSH session with the computer.
Although the Send Unix Commands feature is effective in a number of situations, whether or not to use it instead of or in addition to SSH tends to be a matter of personal preference. Unix-savvy users often find the feature cumbersome. Users who need to issue configuration changes that must be made from the command line or those that are more efficiently made using Unix commands across a large number of computers often find this feature to be a time-saver.
To use the Send Unix Commands feature, select the workstations to which you want to send commands and then select Send UNIX Command from the Manage menu. In the Send UNIX Command task dialog box (shown in Figure 4), you will see a large textbox in which you can enter the command(s) that you want to execute. They will be executed using the bash shell. You also have the option of specifying the user account used to run the commands. By default, current Console User On Target Computer is selected, meaning the account with which your Remote Desktop configuration authenticated to the computer. You can select the User option and enter the shortname of a network user or a local user on the target computer(s) instead.
Figure 4 Send UNIX Command task dialog box
You also have the option to display the output results of the command. If you select the checkbox for this option a report-style window, like the one in Figure 5, will be displayed once the command or commands have been executed. The window will include a list of the target computers that also indicates whether the task succeeded or failed. Selecting each computer, the specific output that would normally be displayed at the command line is displayed below the list.
Figure 5 Unix command output window
As with all task dialog boxes in Remote Desktop, you can opt to send commands immediately or to save or schedule the task for later user. This option enables you to include Unix commands with other Remote Desktop tasks in Automator workflows or scheduled groups of tasks. This is similar but a bit more flexible than issuing regular commands with the Unix cron tool.
Another feature worth mentioning is Remote Desktop’s use of task templates. As we’ll talk about in the final article of this series, virtually all Remote Desktop task dialog boxes include a template menu that enables you to save common variations of each type of task. The Send UNIX Command task dialog box is the only one that comes with preconfigured templates for common command-line tasks. This can be helpful for users who are not particularly familiar with using Unix commands.