Possible duplicate of scp to remote server with sudo
I'm facing the following issue:
- A folder (with sub-folders) with files belonging to
usr1:usr1 - I login with another user
usr2 usr2can dosudo -u usr1- How can I copy the whole folder to another Linux box over ssh?
I tried the following with no success:
sudo -u usr1 tar cf - * | ssh usr2@host 'cd /tmp/dump; sudo -u usr1 tar xf -'
Any help would be appreciated