unixsshrootscp

Why am i getting permission denied in SCP for a local file as root?


I am trying to copy a file f I created on my local machine to a remote one (to the home directory of my user there) by SCP. I have root privileges on my machine, but after executing:

scp f username@remote.edu:/  

I get:

scp: /f: Permission denied  

Also

ls -l f  

returns:

-rw-rw-r--  

I'm confused, shouldn't i be able to copy it as root? Or even without it given the permissions?


Solution

  • This is error from remote side saying that you don't have write access to the / of the remote.edu. I guess you don't want to copy the file to the /, but to the home directory:

    scp f username@remote.edu:
    

    SCP is a simple tool and does not have very advanced error reporting features and the messages might not be so straightforward as expected. But if you run the same command with -vvv switches, it should tell you more information what is going on behind the scenes and where the error is actually coming from.