Mein Script:
#!/bin/bash
set -e
SERVER_IP="192.168.80.106"
SERVER_USER="ich"
# Pfad, wo dein Backup-Skript AUF DEM SERVER liegt (bitte falls nötig anpassen)
REMOTE_SCRIPT="/home/ich/bin/backup.sh"
# Das Backup-Skript auf dem Server via SSH ausführen
echo "========================= Führe Backup-Skript auf dem Server aus..."
ssh ${SERVER_USER}@${SERVER_IP} "sudo ${REMOTE_SCRIPT}"
Fehlermeldung:
sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper
sudo: a password is required
Lösung auf dem Server:
sudo visudo
ich ALL=(ALL) NOPASSWD: /home/ich/bin/backup.sh
Tags: