使用公钥通过 SSH 连接到服务器

发布于 2024-10-06 13:24:45 字数 193 浏览 1 评论 0原文

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

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

ssh -i (KeyFilePath) username@(域名或IP)

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

谢谢,

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 connect it via MAC terminal using below command.

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

But unfortunately, I can't connect using Xcode.

Thanks,

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

始于初秋 2024-10-13 13:24:45

您可能需要考虑首先将私钥(或多个密钥)添加到身份验证代理。从那时起,所有 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)。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文