Last active
December 14, 2017 11:10
-
-
Save bovender/5bd181203aee2b747242f4566807bd1d to your computer and use it in GitHub Desktop.
rsync with sudo on a remote Ubuntu machine
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Uses rsync with sudo privileges on a remote machine | |
# By Daniel Kraus (bovender), released into the public domain | |
# | |
# Inspired by: https://unix.bris.ac.uk/2015/08/04/rsync-between-two-hosts-using-sudo-and-a-password-prompt/ | |
# | |
# To use this, an askpass program must be installed on the | |
# remote node. For Debian/Ubuntu systems, use: | |
# | |
# sudo apt install ssh-askpass | |
# | |
# You may want to confirm the absolute path of ssh-askpass: | |
# | |
# which ssh-askpass | |
rsync -e 'ssh -X' --rsync-path='SUDO_ASKPASS=/usr/bin/ssh-askpass sudo rsync' "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment