remote scp command

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I hope I'm at the right place for my question. Consider this:

jlamsens@ubuntu1:~$ cat /etc/hosts
127.0.0.1 localhost
192.168.155.186 ubuntu1
192.168.155.187 ubuntu2

jlamsens@ubuntu1:~$ touch file.txt

1.) This works, because I can write to /tmp
jlamsens@ubuntu1:~$ scp file.txt jlamsens@xxxxxxxxxxxxxxx:/tmp
jlamsens@xxxxxxxxxxxxxxx's password:
file.txt 100% 0 0.0KB/s 00:00
2.) This works, because I use sudo
jlamsens@ubuntu1:~$ ssh jlamsens@xxxxxxxxxxxxxxx 'sudo touch /root/file.txt'
jlamsens@xxxxxxxxxxxxxxx's 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@xxxxxxxxxxxxxxx:/root/
jlamsens@xxxxxxxxxxxxxxx's password:
scp: /root//file.txt: Permission denied

How can I make the last one work in one shot, knowing that I can use sudo in step 2.) -> I don't want to login to ubuntu2, and do the scp the other way arount -> I don't want to scp to e.g. ubuntu2:/tmp first, login to ubunt2 and move from ubuntu2:/tmp to ubuntu2:/root

Thanks in advance,
Kind regards,
Jurgen Lamsens


[Index of Archives]     [Open SSH Unix Development]     [Fedora Users]     [Fedora Desktop]     [Yosemite Backpacking]     [KDE Users]     [Gnome Users]

  Powered by Linux