gcp vm expired password - ghdrako/doc_snipets GitHub Wiki

Before check if your firewall is set correctly.

    • Go to the VM instances page in Google Cloud Platform console.
    • Click on the instance for which you want to add a startup script.
    • Click the Edit button at the top of the page.
    • Click on ‘Enable connecting to serial ports’
    • Under Custom metadata, click Add item.
    • Set 'Key' to 'startup-script' and set 'Value' to this script:
#! /bin/bash 
useradd -G sudo USERNAME 
echo 'USERNAME:PASSWORD' | chpasswd
#! /bin/bash 
passwd -x -1 USERNAME   # lub chage -M -1 USERNAME  ustawienie niewygasajacego hasla
    • Click Save and then click RESET on the top of the page. You might need to wait for some time for the instance to reboot.
    • Click on 'Connect to serial port' in the page. 9 - In the new window, you might need to wait a bit and press on Enter of your keyboard once; then, you should see the login prompt. 10.. Login using the USERNAME and PASSWORD you provided.

From there undo any change that you've done, if you have sshguard check if your IP is blocked.