[英]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.