Add ssh key and some fixes for constant password asking on remote end

This commit is contained in:
2026-09-02 00:14:32 +03:00
parent b98d7877fc
commit 96ae9abcb7
2 changed files with 34 additions and 5 deletions
+6 -5
View File
@@ -17,13 +17,14 @@ Arguments:
Options:
-n, --dry-run Print the ZFS and SSH commands without running them.
-i, --identity-file FILE SSH private key to use.
-i, --identity-file FILE SSH private key to use.
-p, --ssh-port PORT SSH port to use.
--destroy-source-snapshots Destroy each local migration snapshot after its successful receive.
-h, --help Show this help.
The remote SSH account must be able to run `sudo -n zfs receive` without a
password prompt. This script does not destroy source filesystems or data.
SSH must use key or agent authentication; password prompts are disabled. The
remote SSH account must be able to run `sudo -n zfs receive` without a password
prompt. This script does not destroy source filesystems or data.
EOF
}
@@ -34,7 +35,7 @@ die() {
DRY_RUN=false
DESTROY_SOURCE_SNAPSHOTS=false
SSH_OPTIONS=()
SSH_OPTIONS=(-o BatchMode=yes)
while (($#)); do
case "$1" in
@@ -89,7 +90,7 @@ zpool list -H -o name "$SOURCE_POOL" >/dev/null || die "source pool does not exi
if ! $DRY_RUN; then
ssh "${SSH_OPTIONS[@]}" "$REMOTE_HOST" 'sudo -n zfs list -H -o name -t filesystem >/dev/null' \
|| die "cannot run 'sudo -n zfs' on $REMOTE_HOST"
|| die "cannot connect with non-interactive SSH or run 'sudo -n zfs' on $REMOTE_HOST"
fi
map_destination() {