Skip to content

Instantly share code, notes, and snippets.

@yuchdev
Last active January 7, 2020 10:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yuchdev/3d7fb1c52dd122b9c4209ee54706b313 to your computer and use it in GitHub Desktop.
Save yuchdev/3d7fb1c52dd122b9c4209ee54706b313 to your computer and use it in GitHub Desktop.
Password autorization via SSH utility
sudo apt-get install sshpass
# $1: 1st command-line param, password
# $2: 2nd command-line param, username
# $3: 3rd command-line param, rsync source path
# $4: 4th command-line param, rsync destination path
/usr/bin/rsync -ratlz --rsh="/usr/bin/sshpass -p $1 ssh -o StrictHostKeyChecking=no -l $2" $3 $4
# Alternatively, you can avoid the password prompt on rsync command
# by setting the environment variable RSYNC_PASSWORD to the password
# or using the --password-file option
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment