I would like to have a VM accept all SSH requests. That is, anyone on the network (namely, the host) can SSH into the shell without password checking, public key, etc. I know this is largely against the premise of SSH, but is it possible?

Criterion: It should not be a VM hack; I want this to simulate two computers on the same network, one with 'swiss-cheese' security.

In summary: ssh user_name@host_machine should work, regardless of the nature of the ssh'ing machine, settings, RSA keys, etc.

  • You could recompile sshd to always accept the connection and log them in as some user... – Rook Jul 31 '13 at 6:18
  • Please remember to mention your OS. Both the host and the guest in this case. Answers are very likely to be OS-dependent. – terdon Jul 31 '13 at 16:08

Two options:

  • Recompile SSH to always accept no matter what the password (probably no more than a line or two needs to change)
  • Modify your PAM stack to always accept for authentication. You can make this for all services, or you can specify an alternate PAM stack just for inbound SSH.

Note that I'm a bit rusty on PAM rules, and these are (obviously) not tested. So you may have to tweak things a bit to make it work. Feel free to edit if you get it working.

But for example to allow if the attempted username is listed in a file:

# in /etc/pam.d/sshd
auth sufficient pam_listfile.so item=user sense=allow file=/etc/sshd_allowed_users onerr=fail

Or just permit everything:

# in /etc/pam.d/sshd
auth sufficient pam_permit.so

Presumably a user would have to pick the username of a valid account. But I'm not 100% certain as to what will happen.

  • Fantastic, that's exactly what I was looking for (moreso the second solution, though I think the first one will come in handy as well). Tons of thanks! (Wish I had enough rep to upvote...) – j6m8 Sep 28 '13 at 4:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.