I've got several servers with the following sshd configuration.
# Authentication:
PermitRootLogin no
AllowGroups ssh
PubkeyAuthentication yes
PasswordAuthentication no
This means every user in group "ssh" can login but only with pubkey. The login of root is not allowed.
But there must be an exception for root: my backup server with $ip must login as root.
I tried:
AllowUsers root@$ip
AllowGroups ssh
But AllowUsers overwrites the AllowGroups statement. So only root from $ip can login in.
Match User root, Address $ip
PermitRootLogin {yes|without-password}
AllowUsers root
and
Match Address $ip
PermitRootLogin {yes|without-password}
AllowUsers *
Both are completely ignored. Still normal users in group "ssh" can login only.
It's a simply scenario with user login restricted to pubkey and root login restricted to pubkey and certain ip. How to solve?