Transfer file from PC to Pi using, scp

When trying to transfer a file from PC to Pi I get the following error.

Permission denied, please try again.

I have tried several times with the same result. As it asks for the pi password I would have thought it was going fine. The following is the command entered.

scp testcode.txt bryanpi@192.168.0.xxx:Desktop/

Is there something not set up correctly in ’ config’

Thank you. BC

Hey Bryan,
Welcome to the forums!

It is possible that your remote machine does not have the permissions set up right to allow a remote transfer. Try and check if that machine has the permissions adjusted correctly.

The other thing that may be blocking it is your firewall, check the firewall settings to see if it is blocking SSH connection or file transfer.

Cheers,
Blayden

Blayden, Thank you for your response. Fortunately I did have the items you suggested in place.
I found an example online to send the file from the PC command line as below.

D:\temp> scp testcode.txt pi@192.168.0.107:~/
pi@192.168.0.107’s password:
testcode.txt

Thanks you your help.
Bryan C

Is the following command valid? I’m unsure whether you can send directly to 192.168.0.xxx:Desktop/

The problem may have been with the file path.

perhaps try using absolute file paths eg. /home/pi/Desktop/testcode.txt

1 Like

Without knowing your exact requirements but if you don’t need to use the CLI you can try a GUI app like Cyberduck or your PC to transfer your files over SFTP. I use it all the time, you just log in with the username on your Pi. No special software needed on the Pi. Cyberduck is free, but it will prompt you to donate, but that’s optional.

+1 :+1:
Or set up a samba share and share a directory on your network

There’s definitely something satisfying about just sending it direct over CLI though :stuck_out_tongue:

Hello Michael and Steven,

Using on the PC Windows PowerShell the following works successfully.

scp testcode2.py pi@192.168.0.107:

It seems we must use pi@… and not bryanpi@…

I have placed the files on an external drive d: it is so much easier than the main drive.

I find writing the initial code in Notepad on the PC and then transfer to Nano on the pi.

All good thank you for your interest and response.

Bryan C