forked from Deuxfleurs/nixcfg
sshtool: handle sudo passwords that contain quotes or backslashes
This commit is contained in:
parent
6307f7e62f
commit
14c6dae001
1 changed files with 3 additions and 3 deletions
6
sshtool
6
sshtool
|
@ -26,7 +26,7 @@ else
|
|||
fi
|
||||
|
||||
if [ -z "$ROOT_PASS" ]; then
|
||||
read -s -p "Enter remote sudo password: " ROOT_PASS
|
||||
read -r -s -p "Enter remote sudo password: " ROOT_PASS
|
||||
echo
|
||||
fi
|
||||
|
||||
|
@ -37,11 +37,11 @@ function header {
|
|||
cat <<EOF
|
||||
cat > /tmp/deploytool_askpass_$RANDNAME <<EOG
|
||||
#!/usr/bin/env sh
|
||||
echo "\\\$DEPLOYTOOL_ROOT_PASSWORD"
|
||||
echo "\\\$DEPLOYTOOL_ROOT_PASSWORD" | base64 -d
|
||||
EOG
|
||||
chmod +x /tmp/deploytool_askpass_$RANDNAME
|
||||
export SUDO_ASKPASS=/tmp/deploytool_askpass_$RANDNAME
|
||||
export DEPLOYTOOL_ROOT_PASSWORD="$ROOT_PASS"
|
||||
export DEPLOYTOOL_ROOT_PASSWORD=$(echo $ROOT_PASS | base64)
|
||||
sudo -A sh - <<'EOEVERYTHING'
|
||||
set -e
|
||||
EOF
|
||||
|
|
Loading…
Reference in a new issue