Sshkey install update.
Wrote a script a while back to put your ssh key on a remote system so you do not have to type in the password all the time. Found a few shortcomings with it and now have updated it. You will have to type in your password to login and complete the script process.
installkey.sh
# invoke with ./Installkey.sh servername
# set up the .ssh dir if it does not exist
DIRECTORY=",ssh"
ssh $1 'if [ ! -d "$DIRECTORY" ]; then mkdir $DIRECTORY ;chmod 700 $DIRECTORY ; fi'
# copy the key
scp $DIRECTORY/id_dsa.pub $1:~/.
# install the key
ssh $1 'cat id_dsa.pub >> $DIRECTORY/authorized_keys'
ssh $1 'chmod 600 $DIRECTORY/authorized_keys '
# remove the public key you just copied
ssh $1 'rm ~/id_dsa.pub'
installkey.sh
# invoke with ./Installkey.sh servername
# set up the .ssh dir if it does not exist
DIRECTORY=",ssh"
ssh $1 'if [ ! -d "$DIRECTORY" ]; then mkdir $DIRECTORY ;chmod 700 $DIRECTORY ; fi'
# copy the key
scp $DIRECTORY/id_dsa.pub $1:~/.
# install the key
ssh $1 'cat id_dsa.pub >> $DIRECTORY/authorized_keys'
ssh $1 'chmod 600 $DIRECTORY/authorized_keys '
# remove the public key you just copied
ssh $1 'rm ~/id_dsa.pub'
Comments
Post a Comment