As part of a startup script I have to automatically open several gnome-terminal windows, one of those terminals automatically send:
ssh [email protected]
The limitation with this is that I still need to type a password to complete the SSH connection.
What I want to do is for my script to initiate the command and complete the connection. To that extent, I attempted to follow the instructions as outlined in the accepted answer here.
From the system I wish to connect from, I ran:
ssh-keygen
Enter file in which to save the key: /home/user/ssh/keys/server1key
It then prompted me to enter a passphrase. I left this empty, as I wasn't sure what it would be for, so I assumed setting one would require unlocking it with said passphrase each time I'd use it.
Continuing with the instructions linked above, I then ran and received the following:
ssh-copy-id user@IP
ERROR: No identities found
A quick search revealed that I needed to specify the location of the key, as it was not in the default save location, so I fixed that:
ssh-copy-id -i /home/user/ssh/keys/server1key.pub [email protected]
After asking for the server's password, it successfully added the key. However, upon attempting to log in with "ssh user@IP", I was still prompted for the password.
As far as I'm aware, I followed the linked instructions correctly, so either I'm missing something, or perhaps an existing configuration is preventing me for getting this to work?
Both systems use 18.04 and openssh.