0

I have two LANs with routers tunneled to communicate with my Debian servers over the Internet. That works fine. I can SSH with certificates so as not requiring password to connect local server1 user (Tom) to remote server user (Harry). I am confused as to setting the directory permissions, owner and groups on the remote server directories so as to scp files from my local LAN server(s) to the remote server without getting Permission Denied. I could complicate this question further by stating the local LAN has 3 servers and a NAS plus I hope to automate this with Perl and crontab. Though just the basics in helping to clarify this would be greatly appreciated. Thank you.

1 Answer 1

0

A file system Permission denied error has nothing to do with your SSH connection. Only the permissions granted to the userids at each end matter. Consider:

$ whoami
tom
$ scp foo harry@remote:bar
  • User tom must be able to read pathname foo.

    • You can test this without using scp -- just try to read the file foo.
  • User harry must be able to write pathname bar on remote.

    • You can test this without using scp -- just login to remote as harry and try to write the file bar (as harry).

If either of the above tests fail, the scp will fail.

For example:

$ scp /etc/shadow harry@remote:bar
/etc/shadow: Permission denied

Local user tom cannot read /etc/shadow.

$ touch foo
$ scp foo harry@remote:/etc/shadow
scp: /etc/shadow: Permission denied

Remote user harry cannot write to /etc/shadow.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .