help-cfengine
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

using vipw in cfengine


From: Brendan Strejcek
Subject: using vipw in cfengine
Date: Mon, 29 Mar 2004 18:30:21 -0600
User-agent: Mutt/1.3.28i

I recently ran across the following problem. I needed to install a
package which required a pseudo user. Normally, the package program
takes care of the user addition, but in this case we had an nis user
with the same name that did not make the application happy. And useradd
refuses to create a local user to override the nis user. So I needed a
way to safely add such a user. This was my solution.

shellcommands:

    # check if the user has been added yet
    "/bin/grep ^${newuser} /etc/passwd >/dev/null 2>&1"
        define=user_added

    !user_added::
        
        # add a local user; sed allows indentation preservation
        "/bin/sed 's/^ *//' <<'            EOF' | EDITOR=ed vipw
            /^\+/
            -    
            a
            ${etc_passwd_line}
            .
            w
            q
            EOF"

Just thought I would share. :-)

I think this would be a nice candidate for a method, but I have not
tried that yet.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]