'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 [email protected]:/  

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 1:[1]

to resolve this error, assign Read-write-execute (rwx) permission to everyone.

$ sudo chmod 777 "path-to-your-remote-directory"

Link : https://cloudlinuxtech.com/scp-permission-denied/

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 salah