16

Sending Commands to a Remote Server

Secure Shell (SSH) lets you send secure, encrypted commands to a server over the network. You can use the ssh command in Terminal to open a command-line connection to a remote server. While the connection is open, commands you type are performed on the remote server.

Note: You can use any application that supports SSH to connect to Mac OS X Server.

To open a connection to a remote server:

1Open Terminal.

2Type the following command to log in to the remote server:

ssh -l username server

where username is the name of an administrator user on the remote server and server is the name or IP address of the server.

Example: ssh -l admin 10.0.1.2

3If this is the first time you’ve connected to the server, you’re prompted to continue connecting after the remote computer’s RSA fingerprint is displayed. Type yes and press Return.

4When prompted, type the user’s password (the user’s password on the remote server) and press Return.

The command prompt changes to show that you’re now connected to the remote server. In the case of the above example, the prompt might look like

[10.0.1.2:~] admin$

5To send a command to the remote server, type the command and press Return.

To close a remote connection

mType logout and press Return.

Sending a Single Command

You can authenticate and send a command using a single typed line by appending the command you want to execute to the basic ssh command.

For example, to delete a file you could type

$ ssh -l admin server1.company.com rm /Users/admin/Documents/report

or

$ ssh -l admin@server1.company.com "rm /Users/admin/Documents/report"

You’re prompted for the user’s password.

Chapter 1 Typing Commands

Page 16
Image 16
Apple oxs manual Sending Commands to a Remote Server, Sending a Single Command, To open a connection to a remote server