简体   繁体   English

在VM上使用SCP时出现连接拒绝错误

[英]Getting Connection refused error when using scp on VM

I have a virtual linux build running on qemu (It runs drop bear as ssh client.) and I am trying to copy some modules I wrote to it using scp using the following command: 我有一个在qemu上运行的虚拟linux构建(它作为ssh客户端运行drop bear。),我正在尝试使用以下命令使用scp复制我写给它的一些模块:

    scp -vvv -p 2222 wd/day10/int_mod.ko root@localhost:/lib/modules/3.13.5/int_mod.ko

And I get Connection refused error more specifically (I forwarded 2222 to 22 of virtual machine.): 而且我得到的连接拒绝错误更具体(我转发2222到22的虚拟机。):

Executing: program /usr/bin/ssh host localhost, user root, command scp -v -p -d -t /lib/modules/3.13.5/int_mod.ko
OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to localhost [127.0.0.1] port 22.
debug1: connect to address 127.0.0.1 port 22: Connection refused
ssh: connect to host localhost port 22: Connection refused
lost connection

What I don't understand is I can easily connect to ssh using 我不明白的是,我可以使用以下命令轻松连接到ssh

   ssh -p 2222 root@localhost

I can connect without any problem. 我可以毫无问题地连接。

ssh and scp use different options for specifying the port. ssh和scp使用不同的选项来指定端口。 From the ssh man page: 在ssh手册页中:

[-p port]

From the scp man page: 从scp手册页:

[-P port]

scp uses capital P. Notice how your debug output says port 22 connection refused when you are trying to connect to port 2222. scp使用大写字母P。请注意,当您尝试连接端口2222时,调试输出显示端口22连接被拒绝。

Problem is that , ssh package is not installed completely! 问题是, ssh软件包没有完全安装! you must install ssh and openssh-client so on... with Synaptic Package Manager! 您必须使用Synaptic Package Manager安装sshopenssh-client等等。

in Synaptic Package Manager , first type ssh in search filter and mark ssh . 在Synaptic软件包管理器中,首先在搜索过滤器中键入ssh并标记ssh then click on Apply Button to install ssh services for server and client. 然后单击“应用”按钮为服务器和客户端安装ssh服务。

by this way your problem will fixed 100 Percentage!!! 通过这种方式,您的问题将修复100%!!! see bellow Please: 见下面,请:

安装Synaptic Package Manager,然后增加后续步骤...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM