Monday, May 6, 2024
 Popular · Latest · Hot · Upcoming
122
rated 0 times [  122] [ 0]  / answers: 1 / hits: 793552  / 3 Years ago, mon, september 6, 2021, 2:40:28

It's driving me nuts! I just want to transfer one simple file from laptop to server.



I'm using ubuntu on both machines.



So I have:



-rwxr-xr-x 1 sandro    414622 2011-10-14 23:42 sandrophoto-html.tar.gz


And I'm sending it using:



sudo scp -P XXXX sandrophoto-html.tar.gz [email protected]:/media/xx/xx/xx


And I get: scp: /media/xx/xx/xx/sandrophoto-html.tar.gz: Permission denied



p.s. I might be doing this other way around - I want to send file tar.gz that is located on my desktop, to remote server into the folder /media/yadayda


More From » scp

 Answers
2

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.


[#43011] Tuesday, September 7, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
farnic

Total Points: 409
Total Questions: 117
Total Answers: 125

Location: Andorra
Member since Sat, May 27, 2023
1 Year ago
;