Here is a procedure I use often to establish password-less access to machines:
USERNAME=myusername
HOSTNAME=targetmachine.domain.net
ssh -l $USERNAME $HOSTNAME 'mkdir -p ~/.ssh ; chmod 700 ~/.ssh ; touch ~/.ssh/authorized_keys2; chmod 600 ~/.ssh/authorized_keys2'
cat ~/.ssh/id_dsa.pub | ssh -l $USERNAME $HOSTNAME 'sh -c "cat - >>~/.ssh/authorized_keys2"'
How to find out whether a server supports password-less login:
For positive verification:
ssh -o PasswordAuthentication=no -l $USERNAME $HOSTNAME echo 'access confirmed' 2>&1 | grep 'access confirmed' | wc -l | awk '{ print $1 }'
For negative verification:
ssh -o PasswordAuthentication=no -l $USERNAME $HOSTNAME echo 'access confirmed' 2>&1 | grep 'Permission denied' | wc -l | awk '{ print $1 }'
Comments (0)
You don't have permission to comment on this page.