I'm trying to scp (secure copy) a file from a remote server to my local machine. The command I am using is this:

scp user@server:/path/to/source/file.gz /path/to/destination

But the error I get is this:

scp: /path/to/source/file.gz: No such file or directory

The “user” in the scp command is my username on the server. The command syntax appears fine to me. ssh works fine and I can cd to the file and it doesn’t seem to be an access control issue?

EDIT: Thank you John. I spotted the issue.

ls returned this:

-r--r--r-- 1 nobody users 168967171 Mar 10  2009 /path/to/source/file.gz

So, the file was on a read-only file system and user is able to read it but not scp. I just copied the file to a different directory and chown it and worked fine. It would be good if someone can explain why this is the case though.

  • 1
    what does this show? ssh user@server 'ls -l /path/to/source/file.gz'
    – johnshen64
    Jun 4 '12 at 20:36
  • 3
    As noted, the permissions are OK for reading the file, and are not the issue. You post a mock-up path - perhaps in reality you are trying to use a path with e.g. spaces and don't escape them properly. Give the "real" command instead of the synthetic one so we can spot any such errors. Jun 5 '12 at 6:48
  • Most probably you have mistake in the path. Check if it really should start from /, ~ or nothing.
    – Dims
    Sep 22 '14 at 8:33

r (only) permissions don't indicate a read-only filesystem. They indicate that the file is read-only.

The third r indicates that anybody can read the file so there shouldn't have been a problem.

The question is what are the permissions for the parent directory of this file? However, if they're wrong you should have gotten a permission denied error.

Are there any other conditions which might affect this file's availability such as an NFS mount, etc.?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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