Using OpenSSH
, I have enabled ssh-login to my Ubuntu 18.04 machine, call it Remote
and my user account on Remote
is called Remote-User
. I have also made sure that login is only possible by means of public-key authentication. Here comes the actual description of the problem.
I have two local machines, call them Local-A
and Local-B
, and each of them has one user, call them User-A
and User-B
, respectively. I would like to restrict access to Remote-User@Remote
to only User-A
and User-B
and disallow other users, irrespective of whether their public key has been added to the .ssh/authorized_keys
file of Remote-User@Remote
. I tried doing so by adding the line
AllowUsers User-A User-B
to sshd_config
but I noticed that User-B
had ssh access to Remote-User@Remote
even if I simply had
AllowUsers User-A
This makes me think that any user whose public-key has been added to Remote-User@Remote
's .ssh/authorized_keys
file will have access, irrespective of any restrictions I try to impose using AllowUsers
.
I was wondering if anybody has any suggestions on how to tackle this. Bear in mind that I not well-versed in this domain so I might have omitted important information. If so, please let me know and I am happy to update this question.