Skip to content

Instantly share code, notes, and snippets.

@dipanshuchaubey
Last active January 26, 2020 10:02
Show Gist options
  • Save dipanshuchaubey/19246a282f1a67e08aeb9a438b25df80 to your computer and use it in GitHub Desktop.
Save dipanshuchaubey/19246a282f1a67e08aeb9a438b25df80 to your computer and use it in GitHub Desktop.
SSH into VM Instance without Private key

Step 1

SSH into instance using private key or shell provided by the cloud service provider.

Step 2

If you want to create a new user than run

$ sudo adduser username
$ sudo addpasswd username

Step 3

Go to etc/ssh/ and edit sshd_config file.

$ cd /etc/ssh
$ sudo vi sshd_config

Step 4

Set Following as:

PasswordAuthentication yes

If you also want root user to login with password (without private key) set:

PermitRootLogin yes

Step 5

Restart SSH service:

sudo service ssh restart

Step 6

Exit your current session and login using your new credentials.

Protip: If you cant remember your private key use NoIP to get a domain name that you can use to SSH.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment