Linux – Can’t scp file from local to remote host – Permission denied


I have trying to copy some files from local machine to remote host.

root@local:~$ scp /var/www/html/file.php root@remote_host:/var/www/html/test/

The result is

scp: /var/www/html/test: Permission denied

root@remote_host's password:
Permission denied, please try again.

Those are the rights of the folder on the remote machine


Any ideas what can be the problem?

Best Answer

If you login as The root then root has all permissions allowed, regardless permissions on any directory (exclusion can be only if directory has system immutable flag over chflags(1))

You either providing a wrong password or remote host used public key authentication only.