bash - using expect to automatically put pubkey on server -
i'm attempting use expect part of client setup utility (for unison cron job) automatically put machine's pubkey on our server unison can continue work on ssh thereafter.
i have this:
cat ~/.ssh/id_rsa.pub | sh expect.sh touch ~/.ssh/authorized_keys && cat - >> ~/.ssh/authorized_keys
where expect script just:
#!/usr/bin/expect spawn ssh $user@server expect "password:" send $pass; send $r1
and $user , $pass set earlier on in parent script.
now, doesn't work, , i'm not surprised -- thought being bit ambitious cat piping , trying reference $r1 in expect script. however, i'm having hard time seeing how best break down. want create different expect script first scp's id_rsa.pub onto server have ssh script take care of other work. sound wise? thanks!
Comments
Post a Comment