J L*_*J L 93 ssh key-authentication sshfs
我有一个我无法找到答案的问题。我有两台计算机,都运行 Ubuntu Linux 12.04。我已经设置了我的第一台计算机(“家”),以便能够使用公共/私有 RSA 密钥身份验证通过 SSH 连接到我的第二台计算机(“远程”)。
这不是第一个在我的家用计算机上使用密钥身份验证建立的 SSH 连接,因此我的家用计算机有几个 id_rsa 私钥文件(每个文件都用于不同的计算机以进行 SSH 连接)。因此,我能够成功SSH只有当我指定(在密钥文件ssh,该-i选项),使用ssh username@ipaddress -i path/to/keyfile/id_rsa.2。
这很好用。但是,我也想使用sshfs挂载远程文件系统的 。虽然ssh使用多个密钥似乎很好,但我找不到sshfs使用正确私钥(“id_rsa.2”)的方法。
有没有办法sshfs做到这一点?
gol*_*cks 127
以下是对我有用的内容:
sshfs me@x.x.x.x:/remote/path /local/path/ -o IdentityFile=/path/to/key
Run Code Online (Sandbox Code Playgroud)
您可以通过man sshfs以下方式弄清楚:
-o SSHOPT=VAL ssh 选项(参见 man ssh_config)
man ssh_config
身份文件
指定从中读取用户的 DSA、ECDSA 或 DSA 身份验证身份的文件。
小智 25
您需要做的是指定在~/.ssh/config文件中使用哪个私钥。例如:
Host server1.nixcraft.com
IdentityFile ~/backups/.ssh/id_dsa
Host server2.nixcraft.com
IdentityFile /backup/home/userName/.ssh/id_rsa
Run Code Online (Sandbox Code Playgroud)
小智 8
sshfs -o ssh_command='ssh -i path/to/keyfile/id_rsa.2' username@ipaddress:/path /local/path
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
85884 次 |
| 最近记录: |