How to SSH from one Linux EC2 instance to another

Поделиться
HTML-код
  • Опубликовано: 6 сен 2024
  • This video showcases how to SSH from one Linux EC2 instance to another using the target EC2 instance's Private IP address.
    Do subscribe to my channel and provide comments below. If you would like me to create a video on any topic then mention it in the comments.
    This channel is run by Namrata Shah (Nam) who is a dynamic passionate technical woman leader and a life long learner. She has over 16+ years of professional information technology consulting experience. Namrata has been receiver of Microsoft’s Prestigious Most Valuable Professional award (MVP) for two consecutive years and was recognized as Virtual Technology Specialist for BizTalk. She has several certifications under her belt including AWS CSAA, PMP (Certified till 2020), CSM, CSPO, CSD, Six Sigma (Green Belt), SAFe and TOGAF 9.1 Foundation certified.

Комментарии • 141

  • @gerried1218
    @gerried1218 3 года назад +1

    I have been working on this for the past 6 hours and everywhere I checked did not give me the solution. This is the best solution so far. Thanks very much

  • @rameshselva4812
    @rameshselva4812 2 года назад +2

    Ohhh. Thank you so much namrata. This is what exactly my trainer gave us as a task. He taught with windows servers and gave task in Linux. And I executed successfully from this video. Thank you so much once again.

  • @178pal
    @178pal 4 года назад +3

    Awesome.. well explained.. I was stuck at this point for more than 3 hours.. Thanks

  • @sahithipondugula8316
    @sahithipondugula8316 3 года назад +1

    Thanks alot Namrata!! I was trying this for almost 4 hrs and now finally did!

  • @jaanvaan1468
    @jaanvaan1468 4 года назад +1

    I tried same for 2 centos machines in AWS ....but is asking for pem password...But , I haven't set any password for pem file

  • @shankavaramanagha9672
    @shankavaramanagha9672 4 года назад +1

    Hi Namrata, This is the second time, I have benefitted by watching your video. Thanks a lot! Keep the good work going --- Regards Prashant

  • @rishisharma6246
    @rishisharma6246 4 года назад +1

    Thank you so much... Stuck on this from 2 days.. Thank you so much..🙏

  • @rigobertndifon7518
    @rigobertndifon7518 4 года назад +1

    wonderfully demonstrated.Thank you NamrataHSHah

  • @sridharreddy2876
    @sridharreddy2876 3 года назад +1

    Hi Namrata, thanks for your video Its helped me a lot to understand this issue and resolved for me.

  • @RahulSingh-sn3er
    @RahulSingh-sn3er 5 лет назад +1

    TNX for making such imp video, its really very helpful ....

  • @TheKartik555
    @TheKartik555 5 лет назад +1

    Hi Namrata thanks for sharing the knowledge it worked, It would be helpful if you can explain on command functionalities as well.

    • @NamrataHShah
      @NamrataHShah  5 лет назад +1

      Kindly elaborate of command functionalities. I have a few videos on CLI check them out

  • @willcalde
    @willcalde Год назад

    Thank you so much namrata, you are my hero :)

  • @ashrafshaik8051
    @ashrafshaik8051 4 года назад +1

    A very heartful thanks Namrata
    It's very helpful to me

  • @zalakbensureshkumarprajapa1060
    @zalakbensureshkumarprajapa1060 3 года назад +1

    How do I Configure "authorized_keys" for an ssh server and "known_hosts" for an ssh client on each VM instance to allow passphraseless ssh login between two instance.

  • @yanonirmal
    @yanonirmal 5 месяцев назад

    Thankyou so much for the video well explained !!!

  • @rfrancoi
    @rfrancoi 5 лет назад +1

    Thank you for your hard work. Very much appreciated.

  • @harrysingh6163
    @harrysingh6163 2 года назад +1

    I appreciate the job, great video. Done the job in one go.

  • @vishnu-i8l
    @vishnu-i8l Месяц назад

    Nice video and it is a understandable way

  • @kaykann7880
    @kaykann7880 4 года назад +1

    Well explained. Thanks Namrata baji

  • @juigajjar8672
    @juigajjar8672 3 года назад +1

    It was a great help

  • @rajrajendran410
    @rajrajendran410 4 года назад +1

    Thank you so much ,it was very helpful for me , you taught easy way.

  • @jitendrasena1263
    @jitendrasena1263 5 лет назад +1

    Thanks Namrata Mam.....i was needed it

  • @dhineshprabakaran1786
    @dhineshprabakaran1786 3 года назад +1

    Thanks for this valuable sharing. Please continue sharing :-)

  • @AdityaMoray-y9w
    @AdityaMoray-y9w 2 месяца назад

    Hi thank you for the video.Can you SSH without the keypair?

  • @pullareddykotla9836
    @pullareddykotla9836 5 лет назад +2

    Thank you for making nice video and easly grabed it.

  • @i.oawani-mayaki339
    @i.oawani-mayaki339 4 года назад +3

    Very simple steps...unfortunately I got "Permission denied (publickey)" as an error message. I followed the steps

    • @cyliaselloum8001
      @cyliaselloum8001 4 года назад +1

      I.O Awani-Mayaki the same error for me

    • @jobethagulan8645
      @jobethagulan8645 4 года назад +1

      change the chmod option to 400

    • @shaikaslam6963
      @shaikaslam6963 4 года назад

      @@jobethagulan8645 Hi Jobeth, tried changing the file permission to 400, but still, I'm getting the same error as below
      Permission denied (publickey,gssapi-keyex,gssapi-with-mic)

  • @shaikaslam6963
    @shaikaslam6963 4 года назад +2

    Hi Namrata, I have followed all the steps as you have shown in this video, but at last part after changing the file permission to 600, I'm still getting the permission denied error as below
    Permission denied (publickey,gssapi-keyex,gssapi-with-mic)
    Could you please assist me on the same?
    Thanks

  • @aswiniravella8037
    @aswiniravella8037 4 года назад +1

    ma'am why we don't have public IP into the target machine.

  • @kartheekbankapalli8437
    @kartheekbankapalli8437 Год назад

    Thankyou so much..my doubt clear..❤

  • @VigilanteMian
    @VigilanteMian 4 года назад +1

    Very nicely explained, Namrata.

  • @ranjithkumar2034
    @ranjithkumar2034 3 года назад +1

    Nice info ,, keep doing great work

  • @dhwanishah4093
    @dhwanishah4093 2 года назад

    Hi Namrata,
    Why second time putty asked about Enter passphrase for key"", How to solve that?

  • @parikshitkudalkar2854
    @parikshitkudalkar2854 3 года назад

    thanks a lot !! you explained in very easy way !! please keep making videos !!

  • @vlsi227
    @vlsi227 5 лет назад +1

    Hi Namrata Thanks very much for sharing this valuable knowledge. I'm unable connect public ec2 to other private ec2. Can you Give details and how you connected the subnets in two servers.

    • @NamrataHShah
      @NamrataHShah  5 лет назад +1

      If the subnets are in the same vpc then there is trust established already if not then u need to perform vpc peering and establish trust

  • @famss786
    @famss786 3 года назад +1

    Thanks - great videoes

  • @edsonsilva8397
    @edsonsilva8397 3 года назад +1

    Thank you very much!!
    You helped me a lot!

  • @supersaiyan3704
    @supersaiyan3704 3 года назад +1

    Thank you so much mam. It worked like a charm

  • @sushmitha156
    @sushmitha156 5 лет назад +1

    Hi Namratha can you please show how to ssh 2 instaces of different vpc

    • @NamrataHShah
      @NamrataHShah  5 лет назад +1

      Methodology is the same as long as the VPCs are peered. Refer to my VPC peering videos.

  • @kaykann7880
    @kaykann7880 4 года назад

    Hello namrata baji. Problem with ssh to linux ec2c. using putty pageant. my pc-->internet-->ec2-a public(ssh-ok)--->ec2-b private(ssh-ok)----vpc peering----ec2-c private(ssh-access-denied-publickey issue). inbound SG ssh port 22 open for ec2-c. vpc peering active and I can ping to ec2-c. all pkk uploaded to pageant and using check mark "agent forward" in putty. any idea?

  • @SohailKhan-qk4gl
    @SohailKhan-qk4gl 3 года назад

    Hi. Why doesn't your target machine have a public IP address?

  • @sivaramanr7781
    @sivaramanr7781 3 года назад +1

    Thank you very much, it's really useful

  • @DavidBenOtto
    @DavidBenOtto Год назад

    but what if the target has the public IP address? Should the process be the same?

  • @goldentouch7308
    @goldentouch7308 Год назад +1

    Thank you

  • @mahendrarajgude4070
    @mahendrarajgude4070 5 лет назад +1

    Useful video. Thanks

  • @balajimuthukali7487
    @balajimuthukali7487 Год назад +1

    Thanks mam

  • @phoenix281287
    @phoenix281287 2 года назад

    @NamrataHShah: Will these steps work if I try to SSH from one linux EC2 instance to another in a different VPC?

  • @harshith8227
    @harshith8227 4 года назад +1

    Is there any direct way to connect our second instance with the same keypair as first without using that command ??

  • @shubhamrendalkar6791
    @shubhamrendalkar6791 3 года назад

    I have connected as u shown bt not able to copy files. Please help me with this issue

  • @TheEternalBlizzard
    @TheEternalBlizzard 2 года назад

    Can we use it to connect from one instance to another if both are located in *Different Regions* ?! Please confirm. Thanks!

  • @CoolBishop1997
    @CoolBishop1997 4 года назад +1

    very nice tutorial

  • @arig2519
    @arig2519 4 года назад +1

    Good one

  • @balivadasairaghavahemanth1466
    @balivadasairaghavahemanth1466 3 года назад

    is this about Connecting private instance with public instance in EC2 linux ??

  • @nagarajuboddupally-bw8gw
    @nagarajuboddupally-bw8gw 5 месяцев назад

    hi in target server how can u create without public key. its confused me
    i connected same i followed ur vedio, i got permission denied i given the chmos 600 filename but it showing same source server only. not connecting to target server

  • @sivaramakrishnans4133
    @sivaramakrishnans4133 3 года назад +1

    thanq mam u saved me

  • @sanketshahane178
    @sanketshahane178 4 года назад +1

    thank u mam for this tutorial..

  • @kingstanm8671
    @kingstanm8671 5 лет назад +1

    cheers ka, it is quite simple. thanks.
    peace.

  • @adeelshamas3337
    @adeelshamas3337 3 года назад

    I downloaded the .ppk key used putty to ssh into the source ec2, but can I get .pem file?

  • @AmanSingh-xi3xl
    @AmanSingh-xi3xl 3 года назад

    Thanks Namrata- what was the command you used after you connected to the private server from public ? and you created a file in the target server ?

  • @vamsikrishna2330
    @vamsikrishna2330 4 года назад +1

    Thanks much.. this helped a lot

  • @sunilchaudhari5248
    @sunilchaudhari5248 4 года назад

    can u explain if how we can share public key with private instance & connect using public key instead of private key(.pem)?

  • @tmaiswarya9699
    @tmaiswarya9699 3 года назад

    Hi mam,,I got a question in AWS,in my company two developers (developer A and developer B) they have two instance(instance A and instance B) , developer A can access only instance A and developer B can access only instance B,

  • @Noses.
    @Noses. 3 года назад

    Can uses this to log from aws linux to another centos 7 server at home

  • @arpangupta2162
    @arpangupta2162 2 года назад

    why targetlinuxec2 machine doesn't have public ip address

  • @GovindPalanisamy1
    @GovindPalanisamy1 5 лет назад +1

    Thanks, this is working for me with ec2-user. I have postgres user and trying to do the same way, but errors out. Can you please help me here?

    • @NamrataHShah
      @NamrataHShah  5 лет назад

      This method is for AWS EC2 communication ..

  • @mohammedrizwan5359
    @mohammedrizwan5359 2 года назад

    Awsome thank you so much

  • @pidugunagendra8683
    @pidugunagendra8683 2 года назад

    Hi madam will you help me how to provisioning afp2pdf automation server in aws

  • @shivananduppar1130
    @shivananduppar1130 3 года назад

    How to change the private key? If it's exposed to somebody. Can you explain it for us?

  • @sainath691
    @sainath691 3 года назад +1

    Thanks you

  • @sushilmusande9208
    @sushilmusande9208 3 года назад

    Hello Namratah,
    Is there any way to connect to target if i lose/replace the source machine aws key?
    I replaced key of source machine and now i'm not able to ssh to target?
    Thanking you in advance for your suggestion/Help.😊

  • @sujalmitra5328
    @sujalmitra5328 4 года назад +1

    Please share the process to change the permission of the pem file

    • @NamrataHShah
      @NamrataHShah  4 года назад

      on linux it is a command --> chmod

  • @pauleingrid
    @pauleingrid 3 года назад

    Is it possible to create 3 instances and deploy on each(database, nodeJs, ANgularjs) and then conect the three of them?

  • @vipinm655
    @vipinm655 2 года назад

    MAM,I TRIED TO SSH,BUT ALL TIME IT ASKING FOR PASSPHRASE KEY EVEN I DONT ADDED THE PASSPHRASE ,KINDLY HELP ME

  • @chandureddim4327
    @chandureddim4327 3 года назад

    mam, where to learn these commands and what are these commands
    are these ssh commands or linux commands
    the same steps are worked for ubuntu to..
    please reply me mam what are these commands
    thank you..
    and i just felt got saved from corona mam.thank you..for this mam.

  • @phaniindra6040
    @phaniindra6040 5 лет назад +1

    so after doing this can I add these servers into our ansible hosts inventory and run playbook to install any application ?

    • @NamrataHShah
      @NamrataHShah  5 лет назад

      You will need to add the code to login as a part of your script.

    • @MuhammadFadhil-wq2te
      @MuhammadFadhil-wq2te 5 лет назад +2

      yes you can, simply edit /etc/ansible/hosts
      [Group-Name]
      ansible_user= ansible_ssh_private_key_file=

  • @Techvlogs852
    @Techvlogs852 5 лет назад +1

    can you make video on aws route53

    • @NamrataHShah
      @NamrataHShah  5 лет назад

      Will try ... I don't have a registered domain name.

  • @ashrafshaik8051
    @ashrafshaik8051 3 года назад

    Hi Madam could you please explain using git bash also.. with out pemfile

  • @jpnaidu1
    @jpnaidu1 3 года назад

    Here we are able to connect to Private ip and what what about if we need to connect to public ip?

    • @jpnaidu1
      @jpnaidu1 3 года назад +1

      I got answer thx

    • @anubhavs103
      @anubhavs103 2 года назад

      @@jpnaidu1 how bro am connecting through public ip and throwing the error permission denied

  • @dhruvsahu726
    @dhruvsahu726 4 года назад +1

    It's great

  • @fbsoul1
    @fbsoul1 3 года назад +1

    thanks

  • @mohdazhar1787
    @mohdazhar1787 4 года назад

    in nano editor of linux instance pem key is not pasting from notepad how to paste it commands ctrl +v is not working in nano

    • @NamrataHShah
      @NamrataHShah  4 года назад

      Hit enter or Ctrl U ... Ctrl V is for windows

  • @ShahidulIslamShubo
    @ShahidulIslamShubo 5 лет назад

    hlw
    i got a problem there are show this message
    Enter passphrase for key 'newfile':
    how can i get the passphrase for key
    Please help me

  • @Krishiv11
    @Krishiv11 4 года назад

    how to do SSH if both instance having different "Key pair"- file name ?

    • @NamrataHShah
      @NamrataHShah  4 года назад

      Name does not matter as long as the key pair is the same

  • @niteshchidrawar6553
    @niteshchidrawar6553 4 года назад

    permission denied (publickey gssapi-keyex gssapi-with-mic) i tried everything but got this error

  • @nihalshetty6073
    @nihalshetty6073 5 лет назад

    I am getting connection timeout error when I try to do the same.I did change the permission of the file as well ,but still getting the same error.Kindly suggest

    • @NamrataHShah
      @NamrataHShah  5 лет назад

      It is facing issues to connect .. check IP, credentials, security group settings esp. port 22 should be open and the source security group (if different) should have access and check your key.

    • @rashmiraoraghavendra105
      @rashmiraoraghavendra105 4 года назад

      Hi Nihal
      I also faced the same error.
      Were you able to fix it?
      If Yes, Can you please let me know what was the issue?

  • @baludev3242
    @baludev3242 5 лет назад

    I'm unable to connect, I don't know why .. I followed your steps .. still not able to connect

    • @NamrataHShah
      @NamrataHShah  5 лет назад

      Debug it … You might have missed something

  • @TheSimpleUrbanLife
    @TheSimpleUrbanLife 4 года назад

    Hello Namrata!
    I did follow the steps and when I try to do ssh from my master with client private IP, it asks me for the password of the client and I don't remember it. Can you please help me with that?

  • @AmCoolBuddy
    @AmCoolBuddy 5 лет назад

    well. it is working as normal user. But, it is refusing when i am trying as root user
    error like "Please login as the user "ec2-user" rather than the user "root" "
    Can you help me please ?

    • @NamrataHShah
      @NamrataHShah  5 лет назад

      To login into ec2 you need to use ec2-user that is the default. You can switch to the root user after you have successfully logged in and need to perform activities of a root user.

    • @AmCoolBuddy
      @AmCoolBuddy 5 лет назад +1

      @@NamrataHShah @NamrataHShah Thank you for your reply. I have copied the root pub key in the target node and enable public key access then it works. Actually l am setupin chef infra. So it's required direct root acces to deploy a cookbook. Now its fixed. Really I would like to apprentice your video. It was very useful in the beginnings.

  • @kingstanm8671
    @kingstanm8671 5 лет назад

    btw, how for passcode less authentication between two amz ec2?
    please explain.

    • @NamrataHShah
      @NamrataHShah  5 лет назад

      Kindly elaborate more

    • @kingstanm8671
      @kingstanm8671 5 лет назад

      @@NamrataHShah If i need passcode less ssh session between two ec2 (for ansible yaml to work) how i can proceed? please assist.
      i just copied the pub key to the authorised key file and it worked.
      I want to know if any more methods are there?
      peace

  • @abhishekbhandari6477
    @abhishekbhandari6477 5 лет назад

    hi there . When i do this it is asking me for the passphrase?????

    • @NamrataHShah
      @NamrataHShah  5 лет назад

      If you create your key with passphrase then you will need to provide it. See if you create a key without the passphrase.

    • @abhishekbhandari6477
      @abhishekbhandari6477 5 лет назад +1

      I got it the pem file was corrupted. I.e it was not copied properly

  • @darabahmadkhan7250
    @darabahmadkhan7250 4 года назад

    Mam your voice is not clearly audible plss be bit loud that we can understand words more clearly

    • @NamrataHShah
      @NamrataHShah  4 года назад

      I believe the voice is loud and clear. Try and increase your volume.

  • @dhruvsahu726
    @dhruvsahu726 4 года назад +1

    You are a problem solver please post your coarse on udemy of aws

  • @bodob280
    @bodob280 4 года назад +1

    thank you

  • @meghamohan799
    @meghamohan799 2 года назад

    Thankyou