Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have ssh forwarding enabled and ssh to server A. On server A I want to run a script as root and take advantage of the ssh key being forwarded for USER to send a file to system B. I'm getting a permission denied when trying to run the following.

# runuser -l USER -c "scp filename.tgz serverB:~/"
share|improve this question
First check you can access serverB ssh user@serverB – X Tian Feb 11 '14 at 1:07
Yes, all the servers have the key for user. Server A is a staging server. To access server B I have to mySystem->ServerA->ServerB, mySystem->ServerA->ServerC. Direct ssh access to B and C isn't possible. This is done though key forwarding. – LF4 Feb 11 '14 at 19:43

Your Answer


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

Browse other questions tagged or ask your own question.