Connecting to a Remote Computer

You can connect to a remote computer using SSH (secure) or Telnet (non-secure).

Using SSH

Use the ssh tool to create a secure shell connection to a remote computer.

To access a remote computer using ssh:

1Open Terminal.

2Enter the following command to log in to the remote computer, and then press Return:

$ ssh -lusername server

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

$ ssh -l anne 10.0.1.2

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

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

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

10.0.1.2:~ anne$

5To send a command to the remote computer, enter the command and press Return. To close a remote connection, enter logout and press Return.

To authenticate and send a command using a single line, append the command you

want to execute to the basic ssh tool. For example, to delete a file:

$ ssh -l anne server1.example.com rm /Users/anne/Documents/report

or

$ ssh -l anne@server1.example.com "rm /Users/anne/Documents/report"

You’re prompted for the user’s password.

Chapter 2 Connecting to Remote Computers

35

Page 35
Image 35
Apple Mac OS X Server manual Connecting to a Remote Computer, Using SSH, To access a remote computer using ssh