Thread: expect script with gpg decrypt
2 part question:
1. know of "bash scripting" forum posts these?
2. actual issue:
trying automate login device (which not accept key authentication), using expect, keeping secure encrypting password seahorse (or gpg) agent.
"gpg --decrypt my_file" sends decyrpted file's contents, in case password, stdout. need have expect script following:
1. expects see: password
2. uses output of "gpg -d my_file" variable
3. sends variable , hits enter, complete log in.
give me automated log-in, without storing password in cleartext.
using ubuntu 11.04, expect ver. 5.44.1.15-4
typical ssh expect script here: http://bash.cyberciti.biz/security/e...-login-script/
launching yields:
./test.sh 10.248.7.76
spawn ssh root@
ssh: not resolve hostname : name or service not known
send: spawn id exp6 not open
while executing
"send -- "$password\r""
(file "./test.sh" line 13)
you can following set variable in expect script password using output of gpg:
then send $password using expect later, , should have password.code:set password "gpg -d my_file"
should trick:
code:spawn ssh $user@$ipaddress expect { "password" { send "$password\n" expect { "$ " { } } } default { send_user "login failed\n" exit } }
Forum The Ubuntu Forum Community Ubuntu Official Flavours Support General Help [ubuntu] expect script with gpg decrypt
Ubuntu
Comments
Post a Comment