I'm trying to copy a file from my local machine macosx 10.11.6 to a remote server (digital ocean droplet) ubuntu 18.04 using scp. I tried
scp -r /path/to/local/file username@ipaddress:/path/to/folder/where/to/copy
and I got permission denied.
I ssh into the server cd /path/to/folder/where/to/copy
and test with touch index.txt
and got permission denied.
I tried to touch index.txt
with sudo
which worked after input the password.
I tried install and use sshpas
sshpass -p 'mypassword' scp -r /path/to/local/file username@ipaddress:/path/to/folder/where/to/copy
And I got permission denied again.
What is the correct way to copy that file from local to the remote server passing the user password?