Assingment by Shubham Sir (Linux Advanced)
1 > What is public key?
A public key is like a lock you give to others. They use it to send you a message safely, but only you can open it with your private key.
2 >what is private key?
A private key is like a secret key you keep to yourself. It lets you open and read messages sent to you with your public key. Never share your private key; it’s for you only.
3> what is authorized key?
An authorized key is a public key saved on a server to let you log in safely. If your private key matches it, you get access without needing a password.
4 > Create an two ec2 instance and connect with each other and also connect with local ?
Connect to EC2 Instances from Local
Step 1 -
First we create two server :
Create a same key pair for both instance
and make the same name of directory pem.key file in both instance (private key)
Step 2 -
change permissions of your key file:
chmod 400 server.pem
step 3 -
Connect to server_1:
ssh -i "server.pem" ubuntu@<Public_IP_of_server_1>
Step 4 -
Connect to server_2
from server_1
:
First, get the private IP of
server_2
from the EC2 console.Then, use the following command:
ssh -i "server.pem" ubuntu@<Private_IP_of_server_2>
Step 5 -
Connect to the Instances from Your Local Machine
Get the Public IP addresses of
server_1
andserver_2
from the EC2 console.SSH into
server_1
from your local machine:ssh -i "server.pem" ubuntu@<Public_IP_of_server_1>
To connect to
server_2
directly from your local machine, use:ssh -i "server.pem" ubuntu@<Public_IP_of_server_2>