Posts

Showing posts with the label ssh

Accessing a Private hosted application via Public/Bastion instance [AWS]

Image
Let's say you have an application which you have deployed in your Private subnet in AWS and you want to access that application via your Bastion instance / Browser. 1. Assuming that you already have deployed the application on one of your Private Subnet EC2 instance. 2. If deployed correctly, that application should be accessible via http://PRIVATE_IP:PORT/ but since your private instance doesn't have internet access and you cannot directly connect to it. We will use an alternative to it. So to achieve this we will set-up an SSH tunnel and then use it to connect to our application via any Browser. $ ssh -N -R LOCAL_PORT:REMOTE_APP_HOST:REMOTE_APP_PORT USER@LOCAL_HOST -i KEY.PEM Man entry for -R flag: -R [bind_address:]port:host:hostport -R [bind_address:]port:local_socket -R remote_socket:host:hostport -R remote_socket:local_socket Specifies that connections to the given TCP port or Unix socket on the remote (server) host are to be forwarded to the gi...

Password less SSH login (ssh-keygen)

Image
SSH is often used to login from one machine to another machine, There are number of methods to achieve this but mostly in every method it requires authentication..... It also does requires authentication but for one time only i.e. for the first time you need to do a setup and for rest of the times when you will try to login via ssh it will not ask for any password. For achieving this you just need to generate your own personal set of private/public key pair. ssh-keygen is used to generate that key pair for you. A HOWTO for generating your own private/public key pair is given below: Firstly generate your private/public key pair by following command: [admin@sunny Desktop]$ ssh-keygen -t rsa Generating public/private rsa key pair. Enter file in which to save the key (/home/admin/.ssh/id_rsa): [Press enter if you want to save your keys to default location] Enter passphrase (empty for no passphrase): [Enter your passphrase]  Enter same passphrase again:  [E...