7. OpenSSH Users Tools

The commands listed belows are some that we use often in our regular use, but many more exist, and you should check the man page and documentation for more details. The ssh Secure Shell command provides secure encrypted communications between two untrusted hosts over an insecure network. It is a program for logging securely into a remote machine and executing commands from there. It is a suitable replacement for insecure programs like telnet, rlogin, rcp, rdist, and rsh.

To login to a remote machine, use the command:

          [root@deep] /#ssh -l <login_name> <hostname>
          

Example 15.1. Remote login using ssh

          [root@deep] /#ssh -l admin www.openna.com
          


          admin@deep.openna.coms password:
          Last login: Tue Oct 19 1999 18:13:00 -0400 from deep.openna.com
          No mail.          
          
          

          [admin@www ]/admin$
          

Where <login_name> is the name you use to connect to the ssh server and <hostname> is the remote address of your ssh server.


7.1. scp

The scp Secure Copy utility copies files from the local system to a remote system or vice versa, or even between two remote systems using the scp command. To copy files from remote to local system, use the following command:

          [root@deep] /#su admin
          [admin@deep /]$scp -p <login_name@hostname>:/dir/for/file localdir/to/filelocation
          

Example 15.2. scp Secure Copy utility

          [admin@deep /]$ scp1 -p admin@mail:/etc/test1 /tmp
          


          Enter passphrase for RSA key 'admin@mail.openna.com':
          test1                       |          2 KB |   2.0 kB/s | ETA: 00:00:00 | 100%
          


To copy files from local to remote system, use the following command:

          [root@deep] /#su admin
          [admin@deep /]$scp -p localdir/to/filelocation <username@hostname>:/dir/for/file
          

Example 15.3. local to remote

          [admin@deep /]$scp1 -p /usr/bin/test2 admin@mail:/var/tmp
          


          admin@mail's password:
          test2                     |          7 KB |   7.9 kB/s | ETA: 00:00:00 | 100%
          


Tip

The -p option indicates that the modification and access times, as well as modes of the source file, should be preserved on the copy. This is usually desirable.

Some possible uses of OpenSSH softwareare:

  1. Replace telnet, rlogin, rsh, rdist, and rcp.

  2. Make secure backups over the network.

  3. Execute remote commands.

  4. Access to corporate resources over the Internet.