copy

Transferring sudo-accessible files between servers without intermediary files

August 4, 2023(August 23, 2023)
ssh, tar, copy, server

Copy a sudo-accessible file to another server without creating an intermediate file # One can use the tar and ssh commands together to transfer a file that requires sudo access from one server to another without creating an intermediate file. Here are the steps to accomplish this: On the source server, run the following command: sudo tar czvf - /path/to/source/file | ssh username@targetserver 'cat > /path/to/destination/file.tar.gz' This command uses sudo to run the tar command, which archives the file and then sends the archive to another server via ssh. ...