Re: remote scp command

On Fri, Sep 25, 2009 at 12:51:44PM +0200, Jurgen Lamsens wrote:
3.) I want to scp to a directory that I do not have access to, but I
cannot give some kind of sudo parameter to scp:
jlamsens@ubuntu1:~$ scp file.txt jlamsens@xxxxxxxxxxxxxxx:/root/
jlamsens@xxxxxxxxxxxxxxx's password:
scp: /root//file.txt: Permission denied

The easy way would be:

scp file.txt root@xxxxxxxxxxxxxxx:/root/

The harder way would be something like:

ssh jlamsens@xxxxxxxxxxxxxxx sudo sh -c '"cat > /root/file.txt"' < file.txt

But this requires a no-password-given sudoer permission on
because even if you allocate a pseudo-terminal with "ssh -t", you're
still using the stdin stream for data, so sudo can't use it to ask you
for your password.