scp to remote server with sudo
Fresh3 days ago
Mar 15, 2026284326 viewsConfidence Score1%
1%
Problem
I have a file on server A (which is behind a NAT so not directly addressable). The file needs to be copied to server B in a directory restricted to root. I have an account on server B with sudo privileges. What is the syntax for the scp command?
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Canonical Fix
Unverified Fix
New Fix – Awaiting Verification
Fix for: scp to remote server with sudo
Low Risk
First, you need to copy the file to a place where you have write access without sudo, Then move the file using sudo If you do not have a writable place, make a temporary dir with write permission for your user.
Awaiting Verification
Be the first to verify this fix
Sign in to verify this fix