简体   繁体   English

SFTP公钥/私钥认证-在没有密钥位置的情况下可以工作吗?

[英]SFTP public/private key authentication - can it work without the key location?

I use the Jscape library to implement a SFTP client. 我使用Jscape库实现SFTP客户端。 The pieces of information I need is usually the following: 1. Host 2. Port 3. User ID 4. Private key's location 5. Passphrase (optional in some cases) 我通常需要以下信息:1.主机2.端口3.用户ID 4.私钥的位置5.密码(在某些情况下是可选的)

My question is : is there any way to use private key without specifying the private key's location? 我的问题是 :有什么方法可以使用私钥而不指定私钥的位置? For example, the key could be dropped to a certain location and Jscape or some other SFTP API out there would somehow "see" it? 例如,可以将密钥放置到某个位置,而Jscape或其他一些SFTP API会以某种方式“看到”它?

Jscape doesn't seem to support that. Jscape似乎不支持这一点。 I've tried putting a non-passphrase-protected key next to the sftp.jar file (the Jscape library) and that didn't work. 我尝试将非密码保护的密钥放在sftp.jar文件(Jscape库)旁边,但是没有用。

I know specifying the key's location is fairly straightforward and it certainly is one of the use cases I have. 我知道指定密钥的位置非常简单,这当然是我的用例之一。 But I do have reasons behind asking this silly-sounding question. 但是,我确实有理由提出这个听起来很愚蠢的问题。 I appreciate any insight! 我感谢任何见识!

OpenSSH's command line client uses $HOME/.ssh/id_rsa as the default location for the private key, and a few other applications seem to follow this (eg git). OpenSSH的命令行客户端使用$HOME/.ssh/id_rsa作为$HOME/.ssh/id_rsa的默认位置,并且似乎还有其他一些应用程序(例如git)。 So if you're implementing code on top of JScape, you could also use that convention. 因此,如果您要在JScape之上实现代码,则也可以使用该约定。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无论如何通过公钥/私钥认证在多个客户端和sftp服务器之间建立连接? - Is there anyway to establish connection between multiple client and sftp server through public/private key authentication? 使用具有公钥/私钥认证的JSch从远程SFTP服务器接收数据。 任何例子? - Ingesting data from remote SFTP server using JSch with public/private key authentication. Any examples? 如何使用 SFTP 使用 Java 的公共私钥身份验证的可靠示例 - Reliable example of how to use SFTP using public private key authentication with Java 如何使用 apache vfs2 for sftp with public-private-key and without password - How to use apache vfs2 for sftp with public-private-key and without password 带有公用密钥的sftp无法正常工作 - sftp with public key is not working 在内存/嵌入式 SFTP 服务器中使用 Java 中的私钥身份验证进行测试 - In memory/embedded SFTP server for test with private key authentication in Java 有没有密码或私钥参考的连接到SFTP服务器的方法 - Is there a way to connect to SFTP server without password or private key reference 私钥和公钥扩展 - Extensions for Private and Public Key 私钥和公钥 - Private and Public Key 使用 JSch 的公钥身份验证失败,但使用相同的密钥使用 OpenSSH - Public key authentication fails with JSch but work with OpenSSH with the same key
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM