0

I am using debian in my raspberry pi and Ubuntu12.04 in my laptop. I am trying to send some files from my raspberry pi to my laptop. For this I use SSH and use this command:-

sudo scp acc.c tabish@10.42.0.1:/home/

where acc.c is my .c file and 10.42.0.1 is my laptop IP address. But using this command I got this error:-

ssh: connect to host 10.42.0.1 port 22: Connection refused
lost connection

So, my first guess was that I am using SSH command in wrong way, so I decide to send some files from my laptop to raspberry pi(just to check if SSH working properly). For this I write this command:-

sudo scp abc.c  pi@10.42.0.98:/home/

where 10.42.0.98 is my raspberry pi IP address. On this I got this output:-

pi@10.42.0.98's password: 
scp: /home//abc.c: Permission denied

Although I am not able to send file from either side but I am getting different results from each side. So, please tell me how to send files from each side using SSH (specially from raspberry pi to my laptop) and why I am getting different outputs on each side.

UPDATE:- Now I can send file from laptop to raspberry pi but Still can't send file from raspberry pi to laptop

3
  • first of all, you don't have to sudo to run scp. Secondly, only root can write files to /home. I think what you mean is /home/pi. Try: scp abc.c pi@10.42.0.98:
    – linuxgnuru
    Jan 10 '15 at 11:46
  • OK, I can transmit file from laptop to raspberry pi, But still I getting error in transmitting file from raspberry pi to laptop. I am using command :- scp acc.c tabish@10.42.0.1: and getting this output:- ssh: connect to host 10.42.0.1 port 22:Connection refused lost connection Jan 10 '15 at 12:05
  • 1
    Is sshd running on the laptop?
    – linuxgnuru
    Jan 10 '15 at 13:44
3

You can also use the scp command to copy files from the remote location to your local computer. So you could do

scp pi@10.42.0.98:~/acc.c ~/

If this also does not work check if you are the owner of both the local and remote directory and that you have read/write permissions.

0

"Connection refused" means there is nothing listening on the port. What's happening is ssh is looking for an ssh server on your laptop, but there isn't one.

The pi distros run sshd (the ssh server) by default because most people probably want that. But a standard linux desktop distro like you are using on your laptop probably was not configured this way, so if you want to be able to ssh into it from elsewhere (or use scp to it), then you need to configure and run sshd on the laptop. You'll also have to open port 22 if you use a firewall.

0

I had the same problem and was able to solve it as suggested by installing openssh-server on the Ubuntu laptop. Thx for the Q and help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.