SSH (Secure Socket Shell) is a program created to allow users to log into another computer over a network, to execute commands on that computer and to move files to and from that computer. It effectively replaces telnet, ftp and the rcp/rsh/remsh programs.
How secure shell (SSH) works? Secure Shell is a network protocol for securing data that flows between the client and the server over a public network such as the internet when a client connects to a server it needs to be verified, so the transaction can be considered secure. One of the methods to authenticate the client is an exchange of cryptographic keys after the server successfully authenticate the client, a tunnelled connection is established then secure shell provides encrypted file transfer between the client and the server.
Another useful application of Secure Shell is the ability to securely execute system commands and programs from a remote location. Secure Shell adds security to applications which normally would be considered insecure, in general, each TCP/IP application uses a dedicated port to communicate, but with port forwarding, many applications can use a single secure port 22.
SSH secures users from network attacks such as IP spoofing, IP source routing, and DNS spoofing. A hacker who has managed to attack a network can only make ssh to disconnect. He or she cannot hack the traffic or hijack the connection when encryption enabled.