Skip to content

Instantly share code, notes, and snippets.

Chris himynameschris

Block or report user

Report or block himynameschris

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
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
You can’t perform that action at this time.