From a bash script:
source ./expect.sh
I am including a expect code:
#!/bin/bash
/usr/bin/expect <<EOL
spawn ssh-copy-id -i /home/user/.ssh/id_rsa.pub 111.111.111
expect '*?assword*'
send 'thepassword'
interact
EOL
And I am getting this:
spawn ssh-copy-id -i /home/user/.ssh/id_rsa.pub 111.111.111.111
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
[email protected]'s password:
Then I try to connect and I am prompted for a password...
Checking the server, I'm certain no key was uploaded because I would expect to list the "authorized_keys" file:
root@server: ls /home/user/.ssh/
known_hosts
What am I doing wrong?