Re: Check if a user in group exists
"vratislav.podzimek via help-cfengine" <[email protected]>
| Newsgroups | gmane.comp.sysutils.cfengine.general |
|---|---|
| Message-ID | <[email protected]> |
On Mon, 2022-02-14 at 12:57 -0800, [email protected] wrote: > Hello! > I have hard coded for add a user in group. How to check by 'ifvarclass' (or any), that a user in > group exist and don't run the command 'usermod'? > command: > "/usr/sbin/usermod -a -G $(group_index) $(user_index)"; Makes me think we could extend the userexists() function to take a group name as an optional argument. Without it, I think the best option is to use regline() on /etc/group. -- Vratislav -- You received this message because you are subscribed to the Google Groups "help-cfengine" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/help-cfengine/3b8f1a1b93cec9f9262342b74d75b251880c568f.camel%40northern.tech.