Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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.