scp is returning a permissions denied, not sure why?
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 [email protected]
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.
Related videos on Youtube
Blankman
Updated on September 17, 2022Comments
-
Blankman over 1 year
scp -i ~/.ssh/my_id_rsa -P 30000 some_file.gz [email protected]:/home/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?
UPDATE
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.
-
Admin over 13 yearsDo you have permission to read the file on your local system?
-
Admin over 13 yearsyes I can read on my system no problem.
-
Admin over 13 yearsCan you do
cp some_file.gz /dev/null
under the same conditions that thescp
is failing? -
Admin over 13 years
-
Admin over 13 years
/some_file.gz
in the error message of yourscp
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? -
Admin over 13 yearssome_file.gz is in the current folder that I am executing this command, and yes I am literally typing in the /home/sshuser/
-