Google Cloud virtual machine instance created from snapshot not allowing ssh

后端 未结 2 558
猫巷女王i
猫巷女王i 2020-12-11 23:58

I have created a virtual machine instance from snapshot taken the production server. SSH key is set. But I am unable to ssh into instance both from the putty and google clou

2条回答
  •  南笙
    南笙 (楼主)
    2020-12-12 00:25

    @Patrick answer helps me get to answer, explanatory steps

    1. 1) Serial Console.
      • Go to you instance detail and enable serial port.
      • Connect to your instance using serial port and login with the user and password
      • If you do not have user create one by following script as a startup-script
          #!/bin/bash 
            sudo useradd -G sudo user
            sudo echo 'user:password' | chpasswd 
    
    • sudo systemctl status networking.service to check networking status
    • Remove the /etc/network/interfaces.d/setup file then edit your /etc/network/interfaces
    auto lo
    iface lo inet loopback
    
    • Restart networking service by running sudo systemctl status networking.service

    2) Following startup script also work for me

    #!/bin/bash 
    sudo dhclient eth0
    

提交回复
热议问题