Tuesday, 30 April 2013

What is ssh ?

Leave a Comment

1. What is Secure SHell (SSH)

   SSH is a network protocol which uses public-key cryptography. SSH is more secure than rsh, telnet. Generally SSH is used to access remote machine using password authentication and to form cluster of different machines. You can also see GUI for file manager of remote system so that controlling becomes easier (nautilus for GNOME, krusader for KDE etc.). Generally in Linux, openssh provides SSH protocol. You can use PUTTY to act as SSH client for Windows OS. To install SSH server in windows you have to install CYGWIN. In Windows you can not get GUI through file manager as you do in Linux.
   CYGWIN is a collection of tools which provide a Linux-like environment for Windows operating system.

2. Installation

  • Many Linux OS images comes with this two required packages, openssh client and server already installed on it, but there are some basic images with around 700 MB which won't contain these packages.
  • To know whether you have SSH installed or not you can use the command  " which ssh " if it doesn't give any output then you will have to install it.
  •  To install SSH in CentOS use " yum install openssh* ". This command will install openssh-client and openssh-server for you.
  • To install SSH in Ubuntu use " sudo apt-get install ssh ".
  • To install CYGWIN in Windows please refer this video.

3. Uses

  • Machine with SSH client installed acts as client that can access other machine installed with SSH server.
  • Machine with SSH server installed acts as server and receives multiple request from SSH client.
  • SSH can be used to create cluster of different machines to run any job on cluster using password-less SSH login.
  •  After installing SSH client, you get Secure CoPy (SCP) facility which is  used to copy files to remote host.
To log in remote machine, enter following command

ssh -X user@IP_ADDRESS_OF_REMOTE_SYSTEM

In this command, use of -X Enables X11 forwarding. By using X11 forwarding, we can access GUI using file manager, else you will not be able to access GUI. Be aware of capital X, because small x stands for disable X11 forwarding which won't show you GUI.

4. Errors and Solutions

  • If you are unable to get access into server system, then check the user account name. That user account must be present at server side, because ssh won't give any error even if user account is not present on server side.
  •  " port 22: No route to host " this error occurs when wrong IP address which is not present is entered.
  • One common error is " port 22: Connection refused " this error occur if ssh service at remote system is stopped. You can overcome this by starting ssh service on the remote machine.
  •  Error " WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! " " IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY! "
        Cause :-  This error occurs due to change of OS at the server side or if other illegal person is using your requested server IP whose public key is known to you. Public key is stored in " known_hosts " file present in " /home/user/.ssh/ "  directory at first time when you login to server or remote machine.
        Solution :- If you want to access other machine which is not your requested  server, then you can use following command

" ssh-keygen -R IP_ADDRESS_OF_SERVER "

This command will clear or delete the entry of public key for that particular IP present in known_hosts file and create new entry and old entries are stored in " known_hosts.old "

    0 comments:

    Post a Comment