Ich möchte das utility expect installieren, um in einem Backup-Skript automatisch das Passwort für einen Privat Key einzugeben. das soll es mir ermöglichen, in meinem Backup-skript gesicherte Daten auf einem Vserver automatisch per SCP auf eine NAS zu sichern, die bei mir zu Hause steht. Das Skript würde sonst nicht gehen, weil ich in dem Skript ohne expect irgendwann das Psswort für den private key eingeben müsste. Expect kann diese Passworteingabe automatisieren. Mir ist bewusst, dass ein potentielles risiko ist, wenn das Passwort zum private key im Klartext in einem Skript drinsteht.
leider findet mein apt-get das Paket expect nicht, auch nicht andere paketnamen wie expect-dev, tcl-expect oder tcl-expect-dev gehen nicht. Er sagt immer, das Paket existiert nicht.
Irgendwelche ideen, wie ich das paket draufbekomme? Ich habe einen Strato VServer Linux Level 3 mit Ubuntu 14 drauf.
expect installieren mit apt-get
-
- Project Manager
- Posts: 11183
- Joined: 2003-02-27 01:00
- Location: Hamburg
Re: expect installieren mit apt-get
Zeig mal das Script, eventuell lässt sich das auch ohne expect lösen.
Ansonsten: http://packages.ubuntu.com/lucid/expect ;)
Ansonsten: http://packages.ubuntu.com/lucid/expect ;)
PayPal.Me/JoeUser ● FreeBSD Remote Installation
Wings for Life ● Wings for Life World Run
„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.
Wings for Life ● Wings for Life World Run
„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.
-
- Posts: 10
- Joined: 2014-11-26 15:59
Re: expect installieren mit apt-get
habs installiert gekriegt. Rein interessehalber hier das Skript:
mkdir /root/Backups/$(date +%y%m%d)/
mysqldump -u<user> -p<pw> --databases <db1> > /root/Backups/$(date +%y%m%d)/dump1.sql
mysqldump -u<user> -p<pw> --databases <db2> > /root/Backups/$(date +%y%m%d)/dump2.sql
mkdir /root/Backups/$(date +%y%m%d)/Websitedaten/
cp -rpf /var/www/vhosts/* /root/Backups/$(date +%y%m%d)/Websitedaten/
mkdir /root/Backups/$(date +%y%m%d)/Maildaten/
cp -rpf /var/qmail/mailnames/* /root/Backups/$(date +%y%m%d)/Maildaten/
tar -czf /root/Backups/Backup_$(date +%y%m%d).tar.gz /root/Backups/$(date +%y%m%d)/*
file=Backup_$(date +%y%m%d).tar.gz
export file
./spawn.sh
spawn.sh:
#!/usr/bin/expect -f
spawn scp /root/Backups/$env(file) root@meine_nas_zu_hause:/volume1/Backups/
expect "Enter passphrase for /root/.ssh/id_rsa:"
send "<passphrase>\n";
interact
mkdir /root/Backups/$(date +%y%m%d)/
mysqldump -u<user> -p<pw> --databases <db1> > /root/Backups/$(date +%y%m%d)/dump1.sql
mysqldump -u<user> -p<pw> --databases <db2> > /root/Backups/$(date +%y%m%d)/dump2.sql
mkdir /root/Backups/$(date +%y%m%d)/Websitedaten/
cp -rpf /var/www/vhosts/* /root/Backups/$(date +%y%m%d)/Websitedaten/
mkdir /root/Backups/$(date +%y%m%d)/Maildaten/
cp -rpf /var/qmail/mailnames/* /root/Backups/$(date +%y%m%d)/Maildaten/
tar -czf /root/Backups/Backup_$(date +%y%m%d).tar.gz /root/Backups/$(date +%y%m%d)/*
file=Backup_$(date +%y%m%d).tar.gz
export file
./spawn.sh
spawn.sh:
#!/usr/bin/expect -f
spawn scp /root/Backups/$env(file) root@meine_nas_zu_hause:/volume1/Backups/
expect "Enter passphrase for /root/.ssh/id_rsa:"
send "<passphrase>\n";
interact
-
- Project Manager
- Posts: 11183
- Joined: 2003-02-27 01:00
- Location: Hamburg
Re: expect installieren mit apt-get
Lege Dir am Besten einen eigenen Backup-User auf dem NAS an und verpasse ihm einen SSH-Key ohne zusätzlichem Passwort, dann kannst Du Dir den expect-Hack sparen und hälst auch das root-Passwort des NAS weiter geheim.
PayPal.Me/JoeUser ● FreeBSD Remote Installation
Wings for Life ● Wings for Life World Run
„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.
Wings for Life ● Wings for Life World Run
„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.
-
- Posts: 10
- Joined: 2014-11-26 15:59
Re: expect installieren mit apt-get
danke für den Tipp, wird das beste sein ;)