Skip to content

Instantly share code, notes, and snippets.

View himynameschris's full-sized avatar

Chris himynameschris

View GitHub Profile
@himynameschris
himynameschris / usercheck.sh
Created July 25, 2015 15:37
Check if Linux user exists then test ssh login
#!/bin/sh
while read u; do
echo "checking for username: "$u
getent passwd $u > /dev/null
if [ $? -eq 0 ]; then
id $u
status=$(ssh -o BatchMode=yes -o ConnectTimeout=5 $u@127.0.0.1 -p 22 echo ok 2>&1)
echo $status
fi