开发者

connecting to server through SSH using public key

I am working on one iPhone application on which we need to use SSH integration. I have demo that can connect server with password, but i can't get how to connect that using public key.

I can connec开发者_高级运维t it via MAC terminal using below command.

ssh -i (KeyFilePath) username@(domainname or IP)

But unfortunately, I can't connect using Xcode.

Thanks,


You may want to consider first adding the private key (or keys) to the authentication agent. From that point and on, all ssh commands will re-use 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 loaded, you should be able to use Xcode to connect to (domainname or IP) with no problems.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜