5

我正在开发一个我们需要使用 SSH 集成的 iPhone 应用程序。我有可以使用密码连接服务器的演示,但我不知道如何使用公钥连接它。

我可以使用以下命令通过 MAC 终端连接它。

ssh -i (KeyFilePath) 用户名​​@(域名或IP)

但不幸的是,我无法使用 Xcode 进行连接。

谢谢,

4

1 回答 1

2

您可能要考虑首先将私钥(或多个密钥)添加到身份验证代理。从那时起,所有 ssh 命令都将重新使用缓存的密钥:

# 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

当身份验证代理加载了私钥时,您应该能够使用 Xcode 毫无问题地连接到(域名或 IP)。

于 2010-12-15T13:26:39.277 回答