sshfs無密碼

sshfs無密碼

有人知道 ssh -i 相當於 sshfs 嗎?我想使用 sshfs 而不提示輸入密碼

答案1

最好的解決方案是ssh-agent正如佐爾達什所建議的。

另一種方法是將鑰匙放入~/.ssh/id_rsa,這樣它就會被自動偵測到。 (用於id_dsaDSA 密鑰。)

還有一個是~/.ssh/config。將類似的內容放入其中(ssh_config有關更多詳細信息,請參閱手冊頁)

託管 somebox.somedomain.tld
  用戶喬
  IdentityFile ~/key_for_somebox

主持人 *
  IdentityFile ~/key_for_everything_else

答案2

設定您的系統以使用SSH代理並將您的密鑰新增至代理程式。如果您使用的是最新的 Linux 發行版(即 Ubuntu 等),ssh-agent 可能已經為您設定好了。您只需輸入ssh-add key.

答案3

另一個答案是sshfs -o IdentityFile=/home/me/.ssh/somekey.pem user@host:/path/ mnt/

此外,您還會看到人們列出了另一種呼叫 sshfs 的方法:

sshfs -o ssh_command="ssh -i /home/me/.ssh/somekey.pem" user@host:/path/ mnt/

雖然我同意這~/.ssh/config是要走的路。

答案4

對於任何未來尋找這個的人來說,這對我有用::

sshfs username@host:/yourpath  /yourpath  -o ssh_command='sshpass -p "yourpassword" ssh'

例::

sshfs [email protected]:/media /mnt/ -o ssh_command='sshpass -p 123456789 ssh'

相關內容