There seems two problems with this implementation:
The default timeout for expect seems too short, so if ssh session is slow (e.g. sshd can't resolve ssh client's host name -- UseDNS yes), expect will fire send $passwd\n before establishing the session. This causes ssh-copy-id command to fail.
When the timeout occurs, die ... part won't detect the error.
The
init
command inclus.sh
usesexpect
command when it runsssh-copy-id
command.There seems two problems with this implementation:
expect
seems too short, so if ssh session is slow (e.g. sshd can't resolve ssh client's host name --UseDNS yes
),expect
will firesend $passwd\n
before establishing the session. This causesssh-copy-id
command to fail.die ...
part won't detect the error.