1

I would like to search multiple servers for user ss7459 in the following files /etc/sudoers, /etc/sudoers.d/itse, /etc/sudoers.d/dbas and /etc/group.

NOTE: The numbers after the ss may not be constant across all the servers... on some it may be ss3945... and so on but it all starts with ss.

Can someone please help me write a script for this?

Also, I'll be running this on a satellite with all servers on it thus the main aim is to find out all the servers with that user (ss7***) on them. I'll also be needing a way to get the servers name and compile a list of those servers.

Rui F Ribeiro
  • 56,709
  • 26
  • 150
  • 232

1 Answers1

2

try this:

grep -P 'ss\d+' /etc/group /etc/sudoers.d/dbas  /etc/sudoers.d/itse /etc/sudoers
Baba
  • 3,279
  • awesome...it worked, thanks Babyy...is there a way i can find out all servers with that user(ss7***) on them...cos i'll also be needing a way to get the servers name and compile a list of those servers... i'll eventually post that script on a satellite server – user72803 Jun 17 '14 at 14:44
  • 3
    You'll have to run this command on each of the servers individually. You could make use of ssh and run the above command through ssh looping through a list of servers too. – slm Jun 17 '14 at 14:55