【发布时间】:2016-01-28 04:45:25
【问题描述】:
我正在开发一个 laravel 应用程序,我需要通过 ssh 上传一些文件。
到目前为止,我已经能够在 app/config/remote.php 文件中提供用户和密码来登录 ssh 服务器。它看起来像这样:
'connections' => array(
'production' => array(
'host' => '',
'username' => '',
'password' => '',
'key' => '',
'keyphrase' => '',
'root' => '/var/www',
),
'staging' => array(
'host' => 'localhost',
'username' => 'dhouard',
'password' => 'somepasswordhere',
'key' => '',
'keyphrase' => '',
'root' => '/home/dhouard',
),
),
当我这样做时
SSH::into('staging')->put('somepath/somefile', 'remotepath/remotefile')
文件上传正常。但我需要使用密钥和关键词,但我不知道该怎么做。
我用谷歌搜索了一段时间,但找不到任何教程来做到这一点。
谁能告诉我步骤?
【问题讨论】:
-
不就是把key和keyphrase放到配置设置里吗?
-
你的意思是做'cat .ssh/id_rsa'并将内容放入配置文件吗?
-
不,我想你应该给它你的密钥文件的路径。
-
我尝试过,但出现“无法连接”错误。也许我没有使用正确的密钥。我正在链接我的 linux 主目录中 .ssh 目录中的 id_rsa 文件。我做得对吗?
-
你应该链接到私钥。