scp copy over ssh doesn't work - permission denied error, please?
You have things in the right order from what I understand, the general way an scp is done is:
scp sourceuser@sourcehost:/path/to/source/file destinationuser@destinationhost:/path/to/destination/
Judging by your question, you have a local file you want to send to the destination server. So you have the right syntax which is good!
If you're getting permission denied, then you're not using the correct username or something's amiss with the authentication. Most likely, it's because the sudo command only works locally, for starters, so it won't give you root on the remote box, so that's probably the problem. Make sure that the user you are logging in as on the remote server has write permissions to the location you're trying to write to.
If the problem is the destinationuser doesn't have access to that location without sudo, move the file to the destinationuser's home folder then sudo mv the file from the shell on the other server to put it in the right location.
Hi had this same permission error problem solved it this way
Make sure the directory you are copying to on 192.168.0.4
is owned by the user username
chown username downloads
On your local machine then do
sudo scp filename.zip [email protected]:/etc/Myfiles/downloads
Cheers
Permisssion Denied means you are not the root of the server. You just hold an account there. So in that case you need to do this:
sudo scp -r /path2yourFolder/ username@server_Ip:/home/username
This will copy to your home directory on server.
This will also work:
scp -r /path2yourFolder/ username@server_Ip:~/
I had a similar problem, it happened because ssh
takes -p xxxx
for specifying the port while scp
takes -P xxxx
to specify the port. Minor inconsistency, so easy to miss :(
This error occurred for me when the file already existed in the target location and the existing file had read-only permissions (preventing the file from being overwritten). In my case, I just logged in and deleted the existing file and that corrected the problem.