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:
> jlams...@ubuntu1:~$ scp file.txt [email protected]:/root/
> [email protected]'s password:
> scp: /root//file.txt: Permission denied

The easy way would be:

  scp file.txt [email protected]:/root/

The harder way would be something like:

  ssh [email protected] sudo sh -c '"cat > /root/file.txt"' < file.txt

But this requires a no-password-given sudoer permission on 192.168.155.187
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.

Reply via email to