ssh_add_pass.sh 248 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
#!/bin/bash

if [ $# -ne 2 ] ; then
  echo "Usage: ssh-add-pass.sh keyfile passfile"
  exit 1
fi

eval $(ssh-agent)
pass=$(cat $2)

/amdis/tools/tcl/bin/expect << EOF
  spawn ssh-add $1
  expect "Enter passphrase"
  send "$pass\r"
  expect eof
EOF