How to append the new group to the existing AllowGroups line in /etc/ssh/sshd_config

9 views
Skip to first unread message

karpurap...@gmail.com

unread,
Oct 28, 2021, 8:24:19 AM10/28/21
to Ansible Development
HI Experts,

I would like to append the new group to the existing AllowGroups in /etc/ssh/sshd_config file without disturbing the existing group. I tried with lineinfile module but unfortunately its failing or overwriting existing groups. Can anyone please provide the clue on logic?

existing setup:
# grep AllowGroups /etc/ssh/sshd_config   
AllowGroups x y z

required setup:  let's assume "a" is new group, then i am looking as below
# grep AllowGroups /etc/ssh/sshd_config   
AllowGroups x y z a                 <-----group "a" needs to be added at the end of the line

Once again thanks for your help

Regards,
Suresh
Reply all
Reply to author
Forward
0 new messages