1027SSH Key Permissions too open

This warning is pretty self- explanatory:

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0644 for '/Users/georg/.ssh/my_rsa_key' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.

Solution

Limit the key to read/write access by the user only:

chmod 600 ~/.ssh/my_rsa_key

It's also possible to make it only readable by the user, but then you need to chmod every time you want to update/change it.

chmod 400 ~/.ssh/my_rsa_key

Sources: StackOverflow

976Git, Mac, SSH Keys and the OSX Keychain

When using git with a key that has a passphrase, you are asked the passphrase every time you pull/push. To make this a bit more convenient, add the key to the OSX Keychain.

Store key in OSX Keychain:

ssh-add -K ~/.ssh/my_key

Open .ssh/config

Host *
  UseKeychain yes
  AddKeysToAgent yes
  IdentityFile ~/.ssh/my_key

924Connecting via SSH and Key

ssh -i ~/.ssh/path_to_key username@server

859Using a non-standard key for ssh

How to log-in with ssh, using a non-standard key:

ssh -i ~/.ssh/my_other_key username@host.server.org

289Simulating Keyboard & Mouse Events. And Key-Modifier Events

Creating and Posting a Keyboard Event:
CGEventRef sDown, sUp;
sDown = CGEventCreateKeyboardEvent (
			NULL,
			(CGKeyCode)1,
			true
);
CGEventSetFlags(sDown, kCGEventFlagMaskShift);  

// setting flags with special function. 
// Setting it via CGCreateKeyboardEvent
// would work only for the first time it's run

CGEventPost(kCGHIDEventTap, sDown);

sUp = CGEventCreateKeyboardEvent (
			NULL,
			(CGKeyCode)1,
			false
);
CGEventPost(kCGHIDEventTap, sUp);

CFRelease(sDown);
CFRelease(sUp);
That leaves the door open for applying the same to mouse events:
CGEventRef mouseEvent;
mouseEvent = CGEventCreateMouseEvent (
			NULL,
			kCGEventMouseMoved,
			CGPointMake(100, 100),
			kCGMouseButtonLeft
);
CGEventPost(kCGHIDEventTap, mouseEvent );
Magical. Isn’t it. Of course, in pre-10.6 days it would have looked like that:
CGPostKeyboardEvent (0,5,true);
CGPostKeyboardEvent (0,5,false);