【问题标题】:No such file or directory error on scp commandscp 命令上没有此类文件或目录错误
【发布时间】:2019-05-03 15:01:19
【问题描述】:

我使用 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 错误似乎是一个单独的问题。

有什么想法吗?

【问题讨论】:

  • 你能通过 ssh 连接吗?只需通过 ssh 连接并转到所需的目录。你能在那里列出文件吗?

标签: unix scp codeship


【解决方案1】:

查看文档看到的第一个问题:

man scp:

 -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.

所以scp -p 的意思是“在保留时间戳的同时复制”,65503 是(其中一个)源文件的名称。

改用scp -P 65503

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-02-12
    • 2016-02-26
    • 2021-12-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-11-28
    相关资源
    最近更新 更多