Nothing that I have tried so far has worked; every time I try to transfer my file from one of my servers to the other it asks for a password and it always says permission denied (and before you ask I've checked the password many times (maybe there is a different password for the root account)). I'm already pretty sure it's because the file is in root but I don't know how to fix it, the file has to go into. Does any one know how to transfer the file to the root file? Here's the code I'm using (The Ip and computer names have been changed)

scp -r /home/server/EasyRSA-v3.0.6/pki/reqs/client1.req server@
  • If you can't copy /home/server/EasyRSA-v3.0.6/pki/reqs/client1.req to /tmp, then you can't copy it anywhere else. You are probably the wrong user (without permission to read client1.reg). You also don't need the -r flag if you copy one file and omit the leading zeros in the ip address ( – Freddy Feb 16 '19 at 2:38
  • Are you literally typing server@  Is there a user account called server on the system? – G-Man Says 'Reinstate Monica' Feb 16 '19 at 4:11
  • 1
    Please show (by adding to question), what the error-message is (Run the command, then paste this and error-message into question). – ctrl-alt-delor Feb 16 '19 at 11:53

You say you've tried everything, but the example you provide is giving a very long path to the file.

The first step is verifying that you can access the file on the source server.

cat /home/server/EasyRSA-v3.0.6/pki/reqs/client1.req > /dev/null

If that fails, you can't transfer it as the user you're logged in right now. If you can change your user to the owner of the file or to root, you will probably have better luck.

The second step is to make sure you can write to the target location

ssh server@ ': > /tmp/client1.req; ls -l /tmp/client1.req'

If you can't write to that location as the target user, you won't be able to copy the file there. If the redirect to the file failed but ls still listed a file, you may need to delete that file before you can copy this new file to that spot. Or maybe you need to give it a new name why you copy it.

Assuming that both of the tests above succeeded, but the scp is still failing, then take a look at the output from

ssh -v /home/server/EasyRSA-v3.0.6/pki/reqs/client1.req server@

If that doesn't show an obvious problem, it may help if you can add the output from that, starting right after it indicated the password was accepted (that is, everything after debug1: Authentication succeeded (password).) to your question as additional information.

| improve this answer | |
  • On my Raspberry Pi with username pi, I could not scp any file from my Desktop to RPi's folder /home/pi (permission denied). I conducted test proposed by Ed Grimm and found I cannot write to folder /home/pi from another machine. Checked the ownership of folder /home/pi, found ownership is root root. Checked another RPi to which I can scp files to folder /home/pi, found the ownership of folder home/pi was pi pi. I changed ownership on problematic RPI by command: sudo chown pi:pi /home/pi, and after that I was able to transfer files to /home/pi/ by scp. – abcd567 Dec 25 '19 at 21:14

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