简体   繁体   中英

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:

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

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 -p 2222 root@localhost

I can connect without any problem.

ssh and scp use different options for specifying the port. From the ssh man page:

[-p port]

From the scp man page:

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

Problem is that , ssh package is not installed completely! you must install ssh and openssh-client so on... with Synaptic Package Manager!

in Synaptic Package Manager , first type ssh in search filter and mark ssh . then click on Apply Button to install ssh services for server and client.

by this way your problem will fixed 100 Percentage!!! see bellow Please:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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