Permission denied when using scp, but able to ssh

file-transferpermissionsscp

I'm trying to copy a file from my local desktop to a remote server.

Yes – the remote directory I want to copy to is set to chmod 777
Yes – the server is password protected, and I am sure I have the right password because I am able to ssh onto the server.

The server is for a Drupal 7 site, I've tried Gitbash and Windows PowerShell, on a Windows 10 system. The server is protected and managed with Cisco Anyconnect and Armor.

I can't figure out what the issue is.. Can anyone offer some guidance?

Thanks!

My debug output (I've swapped the user name for <my-user> and the ip address for xxx.xxx.xx.xx):

PS C:\Users\Jill> scp -v ~/logo.png <my-user>@xxx.xxx.xx.xx:/var/www/html/sites/all/themes/bootstrap/bootstrap_subtheme
Executing: program ssh.exe host xxx.xxx.xx.xx, user <my-user>, command scp -v -t /var/www/html/sites/all/themes/bootstrap/bootstrap_subtheme
OpenSSH_for_Windows_7.6p1, LibreSSL 2.6.4
debug1: Connecting to xxx.xxx.xx.xx [xxx.xxx.xx.xx] port 22.
debug1: Connection established.
debug1: identity file C:\\Users\\Jill/.ssh/id_rsa type 0
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\Jill/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\Jill/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\Jill/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\Jill/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\Jill/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\Jill/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\Jill/.ssh/id_ed25519-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_for_Windows_7.6
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3
debug1: match: OpenSSH_5.3 pat OpenSSH_5* compat 0x0c000000
debug1: Authenticating to xxx.xxx.xx.xx:22 as '<my-user>'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: diffie-hellman-group-exchange-sha256
debug1: kex: host key algorithm: ssh-rsa
debug1: kex: server->client cipher: aes128-ctr MAC: umac-64@openssh.com compression: none
debug1: kex: client->server cipher: aes128-ctr MAC: umac-64@openssh.com compression: none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(2048<3072<8192) sent
debug1: got SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: got SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Server host key: ssh-rsa SHA256:5pwb0K9Lm5jDfTygWxEht/0ANL/5/kpCNlZDm/tV3ww
debug1: Host 'xxx.xxx.xx.xx' is known and matches the RSA host key.
debug1: Found key in C:\\Users\\Jill/.ssh/known_hosts:5
debug1: rekey after 4294967296 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 4294967296 blocks
debug1: pubkey_prepare: ssh_get_authentication_socket: No such file or directory
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Next authentication method: publickey
debug1: Offering public key: RSA SHA256:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX C:\\Users\\Jill/.ssh/id_rsa
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Trying private key: C:\\Users\\Jill/.ssh/id_dsa
debug1: Trying private key: C:\\Users\\Jill/.ssh/id_ecdsa
debug1: Trying private key: C:\\Users\\Jill/.ssh/id_ed25519
debug1: Next authentication method: password
debug1: read_passphrase: can't open /dev/tty: No such file or directory
offs01admin@xxx.xxx.xx.xx's password:
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
Permission denied, please try again.
debug1: read_passphrase: can't open /dev/tty: No such file or directory
offs01admin@xxx.xxx.xx.xx's password:
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
Permission denied, please try again.
debug1: read_passphrase: can't open /dev/tty: No such file or directory
offs01admin@xxx.xxx.xx.xx's password:
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: No more authentication methods to try.
offs01admin@xxx.xxx.xx.xx: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
offs01admin@xxx.xxx.xx.xx: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
lost connection

Best Answer

Try copying to home directory of or some other directory (you'll be able to figure out if it is permission issue) and then to the location which you want to actually copy.