Connecting to other computers using SSH

It is common practice to work with unix computers remotely, i.e. over a modem or from the Internet. Historically, telnet or rlogin would have been used to do this. Neither was ever secure, and today both have been supplanted by a secure alternative, the Secure Shell ssh.

The ssh program allows you to work interactively on a remote computer. You can type commands and see their output. In addition, all of the data transfered between the local and remote computer is encrypted. No one can eavesdrop on the text you type, nor see the output that is sent back to you. It its easiest form, you just type ssh remotehost.

Example 7-5. Basic ssh example

$ ssh kronos
Last login: Tue Mar 25 10:21:42 2003 from on pts/0
Linux vh222005 2.4.20 #2 SMP Sun Jan 26 20:13:46 CST 2003 i686 unknown

You can access your home directory from a Windows computer
on the Truman network by sharing \\kronos\user where user is
your account name.

Daily filesystem backups can be found in /snapshot.

A new graphical statistics program is installed, called "salstat".

Here the "message of the day" for kronos has been displayed, and you can see on the last line that the prompt indicates a hostname of vh222005 (the true name of kronos). Any commands typed from this point on, will be executed on kronos. When you are finished, simply type exit or press Ctrl-D to exit the shell and close the connection.

The ssh program is the preferred method for creating secure connections to the unix servers at Truman, including xenon, gold, kronos, and gaia.

Sometimes you may need to login as a different user on the remote host than the username you use on the local host. In that case, you may specify the username and hostname together as user@remote.

Example 7-6. Using ssh with a different remote username

$ ssh root@kronos