Created
January 4, 2015 07:24
-
-
Save welefen/bcc9dc1b513699819a3b to your computer and use it in GitHub Desktop.
Fskey
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
#Here's a little one liner that'll do the trick (for passwordless auth) after you've done the ssh-keygen -d: | |
#how to use: /skey forum@zjm-forum-test10.zjm | |
if [ $# -lt 1 ]; then | |
echo "usage: $0 <username@host>" | |
echo " i.e.: $0 welefen@www.welefen.com" | |
echo | |
exit 1 | |
fi | |
if [ -f "$HOME/.ssh/id_rsa.pub" ]; then | |
echo '' | |
else | |
ssh-keygen -t rsa | |
fi | |
target="$1" | |
ssh "$target" 'test -d .ssh || mkdir -m 0700 .ssh ; cat >>.ssh/authorized_keys && chmod 0600 .ssh/*' < ~/.ssh/id_rsa.pub | |
exit $? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment