Demo - Multiple VMs & Networking - permission denied

Hello everyone, I managed to create the VMs and to assign the IP addresses correctly, but I’m unable to ssh the VMs through command prompt on my windows laptop, because I am asked a password, but when I give in input the pw of the VM I keep getting this error “permission denied (publickey,gssapi-keyex,gssapi-with-mic,password)”.
Could anyone help me? I don’t know what to do to fix.
Thank you very much,
Nicol

Hi @nsaccardi ,
You need to enable the Password authentication for the users.
Run these commands in the VMs terminal: -

sudo sed -i 's/#PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config

restart the service.

sudo systemctl restart sshd

then try to SSH from the windows CMD prompt.

Let me know if you are seeing same issues or other issues.

Regards,
KodeKloud Support

Hi @Tej-Singh-Rana,
thanks for your support. I run the command in the VMs terminal as you suggested and I restarted the service and checked that it was active and running, but unfortunately I’m still facing the same issue on CMD prompt.

Regards,
Nicol

Hi @nsaccardi ,
Oh, so this is the root user but you didn’t mention in the post.

Please try these steps to enable the root login:

Edit the sshd_config file in /etc/ssh/sshd_config:

sudo vi /etc/ssh/sshd_config

Find the line - PermitRootLogin (It’s available under the Authentication section).
This line may be commented out with a “#”.
If this is the case then remove “#” and replace “no” with “yes”.
For your convenience, It should be looks like the below: -

# Authentication:
#LoginGraceTime 2m
PermitRootLogin yes
#StrictModes yes
#MaxAuthTries 6
#MaxSessions 10

Save the changes and after that restart the SSH server:-

sudo systemctl restart sshd

Now try to connect to the server as root user via SSH from CMD prompt.

Let me know if you are able to connect this time.

Regards,