unix - scp 命令上没有此类文件或目录错误
问题描述
我使用 codeship 进行部署,它提供了一种使用 ssh 访问构建机器的方法:
ssh rof@1.2.3.4 -p 65503
这工作正常,我进入机器。现在我想将文件从远程机器复制到我的本地机器。我正在努力:
sudo scp -p 65503 -v -i ~/.ssh/id_rsa rof@1.2.3.4:~/home/rof/cache/app.js /
我得到了一大堆错误:
cp: 65503: No such file or directory
cp: -v: No such file or directory
cp: -i: No such file or directory
rof@23.20.112.101: Permission denied (publickey).
我不知道为什么它对No such file or directory
每个论点都这么说。
id_rsa
存在并且在~/.ssh/
目录中。
Permission Denied 错误似乎是一个单独的问题。
有任何想法吗?
解决方案
我从查看文档中看到的第一个问题:
-P port
Specifies the port to connect to on the remote host. Note that
this option is written with a capital ‘P’, because -p is
already reserved for preserving the times and modes of the
file.
-p Preserves modification times, access times, and modes from the
original file.
Soscp -p
表示“在保留时间戳的同时进行复制”,并且65503
是(其中一个)源文件的名称。
试试scp -P 65503
吧。
推荐阅读
- google-bigquery - 聚合多个未嵌套元素时,标量子查询产生多个元素异常
- javascript - 这段 Javascript 代码中的 octothorpe 是什么意思?
- c - glut.lib 和 glut32.lib 有什么区别?以及如何利用这一点?
- python - 获取 ValueError:Series 的真值不明确。使用 a.empty、a.bool()、a.item()、a.any() 或 a.all()
- c++ - 在 C++ 中编译时出现问题:“未定义对 'WinMain' 的引用。为策划者编写游戏
- javascript - 如何从状态设置输入值并允许用户更改它?
- python - 有没有一种简单的方法可以在 DIN A4 jpeg 上将 Matplotlib 图(Saros Dial)打印到精确尺寸?
- python - 如何在 Python 中将极坐标图导出为分段贝塞尔曲线/SVG 路径
- solr - SOLR:需要对具有字段值的文档和没有字段本身的文档执行过滤查询
- python-3.x - Keras LSTM 层值错误:维度必须相等,但分别为 17 和 2