I have a Cloud Server installation that I frequently add and remove servers from. Currently, when I try to add a new server to the Cloud Server it asks multiple questions that are forcing me to interact with the adding, making automation hard. Before I go and write some overly complicated script to basically say yes a few times I thought I would ask if there is any way to better do this.
On this example, it asks me to confirm public keys and such and log in at least once. However, I have the Cloud Server’s root key already in the authorized_keys file of the NoMachine “servers” (desktops). I’m not sure why it is asking again other than it must be trying to communicate over something specific to NoMachine. Can I automate this or somehow and make this less painful without writing a bunch of expect scripts and stored passwords for prompts that will probably change as the versions are updated.
/etc/NX/nxserver --serveradd newserver.domain.com
- Could not authenticate on the remote server using server’s public key, would you like to add this key and try again [yes|no]
- Could not authenticate on the remote server using server’s public key. Would you like to login on the remote server as a privileged user to add this key and try again? [yes|no]
- sudo password (we have root disabled to all but ssh key)
Seem to me there should be a way to more easily and dynamically add servers to the Cloud Server without having to jump through so many hoops. Any help? Thanks!