Use SSHKeychain on OSX

OSX, Switching, Tools Add comments

SSHKeychain can make the life easier by supplying the local certificates automatically to the remote server. If everything is working fine, you never need to enter a password again; the SSHKeychain itself is protected by the login password of OSX.
First you have to do:

  • open Terminal and enter “ssh-keygen -t dsa”
  • save the stuff inside USERDIR/.ssh/
  • upload the file with the following script
  • go into the SSHKeychain configuration and check “global configuration”
  • log off and on
  • open ssh to the specific server again
  • et voila!


#!/bin/sh

KEY=”$HOME/.ssh/id_rsa.pub”

if [ ! -f ~/.ssh/id_rsa.pub ];then
echo “private key not found at $KEY”
echo “* please create it with “ssh-keygen -t dsa” *”
echo “* to login to the remote host without a password, don’t give the key you create with ssh-keygen a password! *”
exit
fi

if [ -z $1 ];then
echo “Please specify user@host.tld as the first switch to this script”
exit
fi

PORT=”22″
if [ $2 ];then
PORT=”$2″
fi

echo “Putting your key on $1 via port $PORT. “

KEYCODE=`cat $KEY`
ssh -p $PORT -q $1 “mkdir ~/.ssh 2>/dev/null; chmod 700 ~/.ssh; echo “$KEYCODE” >> ~/.ssh/authorized_keys; chmod 644 ~/.ssh/authorized_keys”

echo “done!”

Leave a Reply

WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in
Stoppt die Vorratsdatenspeicherung! Jetzt klicken & handeln!Willst du auch bei der Aktion teilnehmen? Hier findest du alle relevanten Infos und Materialien: