Connecting to the server through SSH using a public key

I am working on one application for the iPhone on which we need to use SSH integration. I have a demo that can connect a server with a password, but I canโ€™t get how to connect it using a public key.

I can connect it through the MAC terminal using the command below.

ssh -i (KeyFilePath) username @ (domain or IP name)

But unfortunately, I cannot connect using Xcode.

Thanks,

+4
source share
1 answer

You might want to first add the private key (or keys) to the authentication agent. From now on, all ssh commands will reuse the cached key:

# Add a new key to the authentication agent $ ssh-add <path to private key> # List current keys $ ssh-add -l # Delete all loaded keys $ ssh-add -D # Add a new key and store the passphrase in your keychain $ ssh-add -K <path to private key1> $ ssh-add -K <path to private key2> # After storing the private keys passphrase in the keychain, # you can load them all, at any time $ ssh-add -k 

When the authentication agent has a private key, you can use Xcode to connect to the domain or IP address without problems.

0
source

All Articles