Content

                                                  Content How to create an AWS free Account? Lab 1: To launch amazon Linux EC2 instance Lab 2: To Connect to the instance from Linux client Operating System Lab 3:To Launch amazon windows instance Lab 4: Installing apache in EC2 instance Lab 5: Installing Nginx in EC2 instance Lab 6: Changing Host Name Lab 7: Creating a user and making as a sudoer Lab 8:Assigning an Elastic ip Lab 9:Creating ebs,attach and detach the volumn to the instance Lab 10:Creating an S3 Bucket and creating cross replication in another region Lab 11:Load Balancer Lab 12:Two instances with Application Load Balancer Lab 13:Launching two instances with load Balancer Lab:14 Creating Own VPC  Lab 15: Two instances which classic load Balance with own VPC Lab 16:Two instances with Application load Balancer with own VPC Lab 17: Relational Data B...

Lab 26:SSH Password Setup

                                                                      SSH Password Setup 

Why we use it ?

Ssh is a protocol to transfer data securely between different machines

Lab:

Steps:

Create two instances

Create the users and make them as server make them as sudoer

Setup password less setup

Step 1:Go to the ec2 dash board

Click on launch instance

Select an ami

 


Select instance type 

 

Make number of instance as 2

 


Leave all other as default

Click as next

 


 


Click on tags

 


Click on configure security group

 


Create a new security group

 


Click on Launch

 


Click on launch create a new keypair and download the key an launch the instance



 Launch the instance





Name the instance as bastion and webserver

Now connect to the bastion

Create a user

And make the user as sudoer


 

Switch to root user

Create a user and name them as bastion

 


Go to the /etc/ssh/sshd_config file password authentication from NO to YES

 


Go to 63 line make password authentication yes

Now restart the service


#systemctl restart sshd 

Now make the user as sudoer

#visudo

And bastion user as root user





Now exit the server

Login the server with bastion user

 


Enter the password

And switch to root user



Now do the same as in another server

Name:webserver

Make the user as sudoer

 


Switch to root user

Create a user named as webserver

And make the user as sudoer

 

Go to /etc/ssh/sshd_config file and make password authentication



Go to the line and make from NO to YES

 

Restart the service

#systemctl restart sshd

 

Now make the user as sudoer

#visudo

Go to the 93 line and enter webserver ALL=(ALL) NOPASSWD = ALL

 

Now exit the server

Again login with the web server user

 

Now switch to root user

 

Step3: password less setup

Now connect to bastion server

Connect with bastion user

And generate key

Copy the public key

#ssh -keygen


It will create the folder of .ssh of your current user bastion

Inside the folder .ssh (id_rsa(private key),id_rsa.pub(publickey)) files will be there

 

No copy the public key to web server of private ip

#ssh-copy-idwebserver@privateip

 



For the first time it will ask the password

Enter the password 

 

Now login to webserver from the bastion server without password (For the first time it will ask the password)

 

You connected web server from bastion server

Exercise :take two instances and do password less setup and try to connect from one server to another server

 

 

 

 

 

 

 

 

 

 

 

 

Comments

Popular posts from this blog

Lab 21:Installing docker in instance and build an image

Lab 22:Pushing a docker image to docker hub

Lab 5: Installing Nginx in EC2 instance