Connect EC2 Linux Instance from windoWs machine

 Owner: Aarav Raj Singh                                                                                                    REF:aws docs

                                **ONLY FOR LEARNING PURPOSE**

                    CONNECT EC2 LINUX INSTANCE FROM WINDOWS MACHINE

     
    Verify PowerShell prerequisites


To install OpenSSH on your Windows OS using PowerShell, you must be running PowerShell version 5.1 or later, and your account must be a member of the built-in Administrators group. Run $PSVersionTable.PSVersion from PowerShell to check your PowerShell version.

To check whether you are a member of the built-in Administrators group, run the following PowerShell command:


Use command :
**open powershell**
              1.If you are member: output will be true

(New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent())).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)

2. use command to install openssh:
Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0




       Copy the example of the page and paste it to terminal. It is quite easy. 

        
        DETAILED :

    AWS EC2 instances don’t have password authentication by default. You have to use       the private key to connect to the instances.

        Using this method you can use the windows default terminal to Login into EC2         without key

  1. Login to AWS instances(ssh using pem file/Putty)

ssh -i your-key.pem username@ip_address

 2. Setup a password for the user

sudo passwd ubuntu

 3. Edit sshd_config file.(use vim or any other editor)

sudo vim /etc/ssh/sshd_config

Find the Line containing ‘PasswordAuthentication’ parameter and change its value from ‘no’ to ‘yes’
Press Esc →: →wq (Esc key. Then “:”, then “wq” and finally press enter. )

  4. Restart the SSH service.

service ssh restart

  5. Now you can log in using the password you set for the user.

ssh username@ip_address

Now it will ask for the password.

That’s it, You are logged into EC2


    

         




Comments