I have around 100 servers on which I want to check if a user exists. Instead of going manually on each and every server, I am trying to write a script to do that. So, far I have written the following script to verify it.
#!/bin/bash
if id user1 >/dev/null 2>&1; then
echo "user1 user exists"
else
echo "user1 user does not exist"
fi
I believe I need to do ssh also into the servers using the script but please suggest if there is a better way to perform it.