Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.
scp -i ~/.ssh/my_id_rsa -P 30000 some_file.gz  sshuser@ 

And it returned:

scp:/some_file.gz: Permission denied

The rsa key file is the same file I use to connect via SSH (along with the port # and username and i.p)

Does anything stand out that could be causing the permission issue?


I have iptables running, do I need another entry for scp or does it use ssh protocol? (silly question but just making sure here!)

I'm not getting a 'connection refused' error so not sure if this is the issue.

share|improve this question
Do you have permission to read the file on your local system? – joschi Nov 27 '10 at 6:57
yes I can read on my system no problem. – Blankman Nov 27 '10 at 6:59
Can you do cp some_file.gz /dev/null under the same conditions that the scp is failing? – Dennis Williamson Nov 27 '10 at 7:10
Can you run scp with --verbose option and post the result somewhere (e.g. on pastebin)? – whitequark Nov 27 '10 at 7:11
/some_file.gz in the error message of your scp call looks like you're trying to copy the file to the root directory (/) of the remote server. Is /home/sshuser/ filled in by a variable or do you literally provide that directory as a target? – joschi Nov 27 '10 at 7:56

1 Answer 1

From the error shown above, it seems that you don't have enough permission to read the file:

scp:/some_file.gz: Permission denied

If you are confused whether the problem is network related or file system related, you can check it separately.

First, you can use ssh to make sure you can connect to the remote host.

$ ssh -p 30000 sshuser@

Second, you can use cp (as noted by Dennis Williamson) to make sure you can read the file.

You will get the "connection refused" error when you try to connect to a closed port on the remote host.

share|improve this answer

Your Answer


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.