Reputation: 357
I am trying to copy dirs and files under the root on the remote host, using non-root user, which one actually doesn`t have access to this folders. So I need something like sudo while copying.
Sample command:
scp user@<host>:<path_to_folder_under_the_root> .
I cannot use root@ cause I have not the root keys local. Is there any possible ways to do this?
Upvotes: 0
Views: 792
Reputation: 311606
Assuming that you do have sudo
access on the remote host, instead of using scp
you can use ssh
and tar
:
ssh user@<host> sudo tar -C <path_to_folder_under_the_root> -cf . | tar -xf-
Upvotes: 1