|Securing and Optimizing Linux: RedHat Edition -A Hands on Guide|
|Prev||Chapter 15. Software -Securities||Next|
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
firstname.lastname@example.org password: Last login: Tue Oct 19 1999 18:13:00 -0400 from deep.openna.com No mail.
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 'email@example.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%
: 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:
Replace telnet, rlogin, rsh, rdist, and rcp.
Make secure backups over the network.
Execute remote commands.
Access to corporate resources over the Internet.