Score:0

Unable to ssh to my virtual machine via Password authentication method

im flag

I am trying to access my virtual machine using ssh but it gives me the message "Permission denied, please try again".

What I want to do is use my ubuntu vm as server and my physical machine (windows 10 Home) as client, in order to connect to my server using ssh via password authentication method (not using keys). What I have done so far is:

1). I use VirtualBox and created an ubuntu 22.04.1 virtual machine. In the settings of VirtualBox I use Bridged Adapter at the Network sector.

2). I am a root user on my ubuntu. (I have not created other accounts).

3). On my ubuntu I installed ssh-server and started the ssh service.

4). At /etc/ssh in my sshd_config file I have:

  • unchecked Port 22
  • unchecked PasswordAuthentication yes
  • unchecked PermitRootLogin and set it to yes.
  • By default, KbdInteractiveAuthentication no is unchecked as well as UsePAM yes, X11Forwarding yes, PrintMotd no, AcceptEnv LANG LC_*, Subsystem sftp /usr/lib/openssh/sftp-server

5). On my windows 10 I have:

  • Installed Client OpenSSH via powershell
  • On Firewall advanced settings to Inbound and Outbound Firewall Rules I have enabled ICMPv4-In and ICMPv6-In, ICMPv4-Out and ICMPv6-Out.

6). I am running as the administrator on my windows. (I have not created other user accounts)

7). I am sure I have the correct IP adresses of both machines. I can ping my ubuntu vm from my windows. I can also ping my windows from my ubuntu vm. I have the usernames and passwords of both machines.

8). Using cmd on windows I try: ssh (username of ubuntu server)@(IP Address of ubuntu server) I type the password and the result is: Permission denied, please try again. On the third try it shows: Permission denied (publickey, password).

9). Checking the auth.log at /var/log I see this:

pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=(my windows IP) user=(my ubuntu's username)

Failed password for (ubuntu's username) from (my windows IP) port 61618 ssh2 

The above message repeated 2 times.

Connection reset by authenticating user (ubuntu username) (windows IP) port 61618 [preauth]

PAM 2 more authentication failures; logname= uid=0 euid=0 tty=ssh ruser= rhost=(my windows IP) user=(my ubuntu's username)

10). On cmd at windows typing ssh -v (ubuntu's username)@(ubuntu's IP) it shows me this: (I type the messages that seem they have error)

pubkey_prepare: ssh_get_authentication_socket: No such file or directory

kex_input_ext_info: [email protected] (unrecognised)

Next authentication method: password

debug1: read_passphrase: can't open /dev/tty: No such file or directory

Then it promts me to type the password for the ubuntu server (still failing ofc)

I apologize for the long post but I really need help.

Thank you in advanced.

hr flag
You seem to be misunderstanding what a "root user" is on Ubuntu - it should not have been necessary to modify the `sshd_config` file at all in order to authenticate with a password as `(username of ubuntu server)@(IP Address of ubuntu server)` (unless `(username of ubuntu server)` is literally `root` of course)
David avatar
cn flag
Why not include all the error messages? The ones you think are not important may be.
user355 avatar
im flag
On my sshd_config I unchecked PermitEmptyPasswords and set it to yes. Now I can ssh to my ubuntu server with success. Thank you for your help. Does that mean that if i create new users on ubuntu who are not root, only then I will need password to ssh to the server?
sudodus avatar
jp flag
Are you running a live or an installed Ubuntu system in the virtual machine? If you run an installed system and your computer is connected to the internet, I would recommend that you use a password (not empty password). I tested with `putty` from Windows, and it works for me with the login password of the system in the virtual machine.
user355 avatar
im flag
@sudodus I have not installed ubuntu in the virtual machine. I am just trying ubuntu in it. When i created a new user (not root) in ubuntu, it required me to login with password, which was done successfully.
sudodus avatar
jp flag
@user355, I see. With the added information of the comments I think it is the expected behaviour for the default user of a live Ubuntu system: `ssh` expects a non-blank password, and you found that you can uncheck `PermitEmptyPasswords` and set it to `yes`.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.