Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.