Server gives me a permission error when trying to scp, but not when ssh

Fallenreaper

Is there server configuration you need to set when you want to scp to a server? If i ssh into the machine, i use:

ssh -i file.pem user@server

but when i try the scp command, it will give me a permissions error.

scp path/to/file.pdf -i file.pem user@server:/home/user/.

What am i doing wrong, and how can i fix it? I cant seem to figure out what's up with it. The error reads as:
Permission denied (publickey). lost connection

prodigitalson

You need to shuffle around your options and arguments. It should be:

scp -i file.pem path/to/file.pdf user@server:/home/user

Note the omission of /. from the end of the target path. It is not necessary because if the last segement of the target is a dir it will copy the files into the directory, just like cp and mv.

Is there a way to assign the file.pem such that it just picks it up when i use: user

You can do that with an ~/.ssh/config config file:

Host            serveralias
HostName        server.com
User            user
IdentityFile    /path/to/your/key.pem

After creating that you can do:

# will effectively be like doing 
# ssh -i /path/to/your/key.pem [email protected]
ssh serveralias

Or

# should pick up on the same settings and effectively like 
# ssh -i /path/to/your/key.pem [email protected]
ssh [email protected]

And they should both use the IdentityFile you specified.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Server gives me a permission error when trying to scp, but not when ssh

From Dev

Error when trying to SSH into server using a WSL

From Dev

scp gives "[file] not a directory" error when using parameters

From Dev

Cloudkit gives error when trying to save a record

From Dev

mysql gives error when trying to update

From Dev

Permission Error When Trying To Install Rails (OSX)

From Dev

Error When Trying To Change Folder Permission

From Dev

When trying to convert a UITextField text to Int Xcode 7 gives me an error

From Dev

Python gives me an error when trying to get anything other than first or last two elements from list

From Dev

key works for logging in via ssh, but scp gives permission denied

From Dev

IIS7.5 Gives 500 Internal Server Error when trying to use DELETE verb

From Dev

Permission denied error when using UseUrls() when trying to launch Kestrel

From Dev

Tmux 1.8 gives "failed to connect to server" when trying to source a file

From Dev

scp to location on remote that requires sudo gives Permission denied error

From Dev

How to fix “Permission denied” when trying to edit a file on aws server?

From Dev

Error when download a file from server using scp

From Dev

PLSQL when trying to change value of length while loop gives error

From Dev

windows partition manager gives an error when trying to shrink the main partition

From Dev

Permission Error when trying to create tunnel to MYSQL DB

From Dev

Error when trying to connect to Team Foundation Server

From Dev

Error when trying to open() sql server

From Dev

Error when trying to run bokeh-server

From Dev

Error when trying to install mysql server

From Dev

Internal Server Error when trying to check url

From Dev

Error when trying to update npm on live server?

From Dev

SQL Server error when trying to connect

From Dev

Getting permission denied for SCP over SSH server to local

From Dev

I'm getting a 'insufficient permission...' error when trying to push to my bare repo on my linux AWS server

From Dev

Why it gives me "segmentation fault" error when I change this code?

Related Related

  1. 1

    Server gives me a permission error when trying to scp, but not when ssh

  2. 2

    Error when trying to SSH into server using a WSL

  3. 3

    scp gives "[file] not a directory" error when using parameters

  4. 4

    Cloudkit gives error when trying to save a record

  5. 5

    mysql gives error when trying to update

  6. 6

    Permission Error When Trying To Install Rails (OSX)

  7. 7

    Error When Trying To Change Folder Permission

  8. 8

    When trying to convert a UITextField text to Int Xcode 7 gives me an error

  9. 9

    Python gives me an error when trying to get anything other than first or last two elements from list

  10. 10

    key works for logging in via ssh, but scp gives permission denied

  11. 11

    IIS7.5 Gives 500 Internal Server Error when trying to use DELETE verb

  12. 12

    Permission denied error when using UseUrls() when trying to launch Kestrel

  13. 13

    Tmux 1.8 gives "failed to connect to server" when trying to source a file

  14. 14

    scp to location on remote that requires sudo gives Permission denied error

  15. 15

    How to fix “Permission denied” when trying to edit a file on aws server?

  16. 16

    Error when download a file from server using scp

  17. 17

    PLSQL when trying to change value of length while loop gives error

  18. 18

    windows partition manager gives an error when trying to shrink the main partition

  19. 19

    Permission Error when trying to create tunnel to MYSQL DB

  20. 20

    Error when trying to connect to Team Foundation Server

  21. 21

    Error when trying to open() sql server

  22. 22

    Error when trying to run bokeh-server

  23. 23

    Error when trying to install mysql server

  24. 24

    Internal Server Error when trying to check url

  25. 25

    Error when trying to update npm on live server?

  26. 26

    SQL Server error when trying to connect

  27. 27

    Getting permission denied for SCP over SSH server to local

  28. 28

    I'm getting a 'insufficient permission...' error when trying to push to my bare repo on my linux AWS server

  29. 29

    Why it gives me "segmentation fault" error when I change this code?

HotTag

Archive