Technically it is not an anwer. it is more like a workaround (because i think it is the way sshd is built(at the time of answering the question))
I tried different kind of permutatuion and combination:
-
Match Group G1
PermitOpen R1:1521
Match Group G2
PermitOpen R2:1521
Match Group G1,G2
PermitOpen R1:1521 R2:1521
So i created G3 and added the groups G1 and G2 which becomes
-
Match Group G1
PermitOpen R1:1521
Match Group G2
PermitOpen R2:1521
Match Group G3
PermitOpen R1:1521 R2:1521
But still it didn't worked. it worked for G1 not for G2.
-
Match Group G1
PermitOpen R1:1521
Match Group G2
PermitOpen R2:1521
Match Group G1,G2,G3
PermitOpen R1:1521 R2:1521
But still it didn't worked. it worked for G1 not for G2.
-
Match Group G1
PermitOpen R1:1521
Match Group G2
PermitOpen R2:1521
Match Group G3
PermitOpen R1:1521 R2:1521
The G3 group has R1 and R2 and it worked.
I think the reason being for the working is because of below reason:
If a keyword appears in multiple Match blocks that are satisfied, only the first instance of the keyword is applied.
Either the above can work or using permitopen in the authorized_keys