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?
Tell me more
×
Super User is a question and answer site for
computer enthusiasts and power users. It's 100% free, no registration required.
|
|
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.
|
|||||||||
|
|
You can use ssh and tar to work around this:
This first updates your sudo timestamp (asking for a password if necessary, which requires a tty ( "tar" on RedHat 5 requires the "--preserve" options to come after the "xpsf -" command. |
||||
|
|
I've written a short program for this. You will need python 2.7 and fabric. |
|||
|
|