Skip to content

Instantly share code, notes, and snippets.

Avatar

Chris himynameschris

View GitHub Profile
@himynameschris
himynameschris / usercheck.sh
Created Jul 25, 2015
Check if Linux user exists then test ssh login
View usercheck.sh
#!/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