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 (at) 192.168.155 (dot) 187 [email concealed]:/root/
> jlamsens (at) 192.168.155 (dot) 187 [email concealed]'s password:
> scp: /root//file.txt: Permission denied
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.
> 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 (at) 192.168.155 (dot) 187 [email concealed]:/root/
> jlamsens (at) 192.168.155 (dot) 187 [email concealed]'s password:
> scp: /root//file.txt: Permission denied
The easy way would be:
scp file.txt root (at) 192.168.155 (dot) 187 [email concealed]:/root/
The harder way would be something like:
ssh jlamsens (at) 192.168.155 (dot) 187 [email concealed] 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 ]