15.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:

          [[email protected]] /#ssh -l <login_name> <hostname>

Example 15-1. Remote login using ssh

          [[email protected]] /#ssh -l admin www.openna.com

          [email protected] password:
          Last login: Tue Oct 19 1999 18:13:00 -0400 from deep.openna.com
          No mail.          

          [[email protected] ]/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.

15.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:

          [[email protected]] /#su admin
          [[email protected] /]$scp -p <[email protected]>:/dir/for/file localdir/to/filelocation

Example 15-2. scp Secure Copy utility

          [[email protected] /]$ scp1 -p [email protected]:/etc/test1 /tmp

Enter passphrase for RSA key '[email protected]': test1 | 2 KB | 2.0 kB/s | ETA: 00:00:00 | 100%

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

          [[email protected]] /#su admin
          [[email protected] /]$scp -p localdir/to/filelocation <[email protected]>:/dir/for/file

Example 15-3. local to remote

          [[email protected] /]$scp1 -p /usr/bin/test2 [email protected]:/var/tmp

[email protected]'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.