Some fixes for non woring sudo
This commit is contained in:
@@ -83,6 +83,10 @@ If this command fails, configure the remote account's `sudoers` entry for the
|
||||
necessary `zfs` commands with `NOPASSWD` before running the migration. Do not
|
||||
put a password in the script or on its command line.
|
||||
|
||||
`REMOTE_HOST` must be a complete hostname or address, such as
|
||||
`root@192.0.2.10` or `admin@new-server`. `root@` is invalid because it has no
|
||||
host after the `@`.
|
||||
|
||||
Options:
|
||||
|
||||
| Option | Description |
|
||||
|
||||
@@ -83,14 +83,18 @@ REMOTE_HOST="$2"
|
||||
DESTINATION_ROOT="${3%/}"
|
||||
SNAPSHOT_NAME="move-$(date +%Y%m%d-%H%M%S)"
|
||||
|
||||
[[ "$REMOTE_HOST" != *@ ]] || die "REMOTE_HOST is missing a hostname; use user@server-name or server-name"
|
||||
|
||||
command -v zfs >/dev/null || die "zfs command was not found"
|
||||
command -v zpool >/dev/null || die "zpool command was not found"
|
||||
command -v ssh >/dev/null || die "ssh command was not found"
|
||||
zpool list -H -o name "$SOURCE_POOL" >/dev/null || die "source pool does not exist: $SOURCE_POOL"
|
||||
|
||||
if ! $DRY_RUN; then
|
||||
ssh "${SSH_OPTIONS[@]}" "$REMOTE_HOST" true \
|
||||
|| die "cannot authenticate to $REMOTE_HOST with SSH keys or an SSH agent"
|
||||
ssh "${SSH_OPTIONS[@]}" "$REMOTE_HOST" 'sudo -n zfs list -H -o name -t filesystem >/dev/null' \
|
||||
|| die "cannot connect with non-interactive SSH or run 'sudo -n zfs' on $REMOTE_HOST"
|
||||
|| die "$REMOTE_HOST accepts SSH, but cannot run 'sudo -n zfs'; configure passwordless sudo for zfs"
|
||||
fi
|
||||
|
||||
map_destination() {
|
||||
|
||||
Reference in New Issue
Block a user