[Kc] Removing users from sudoers

Emmanuel Mejias emmanuel.mejias at gmail.com
Thu May 8 06:24:40 PDT 2008

Okay guys, I'm stuck. Not sure where to go from here.

 I'm trying to create a script to remove users from sudoers on multiple
servers. I'm able to do this with a one-line script using sed, but only if
it's on one server.
*Example: sed '/someuser/d' /host/local/etc/sudoers*
Also, I think the problem with this one-line script is that I would have to
redirect my output to another sudoers file (sudoers.new) and then mv that
file to sudoers for it to work more effectively.

Since the hosts are all tied to the ldap server I can just run the script
from there by changing the host path without having to log into multiple

This is what I have so far in Perl, but I'm not sure how to continue or how
to add the sed line in here.

*#!/usr/bin/perl -w

# this script removes a user from sudoers file

@mysites = ("Alpha", "Echo", "India", "Joliet", "Kilo", "November",
                    "Papa", "Uniform", "Sierra", "Wiskey");

open(FILE, "@mysite/local/etc/sudoers");
@site = <FILE>;

I know I need to throw in a for loop, maybe a few, I don't know. I'm stuck!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/kc/attachments/20080508/21debaaf/attachment.html 

More information about the kc mailing list