Add ssh fingerprint to known_hosts without actually ssh'ing into machine

I am setting up a multi-node hadoop cluster. As a part of this process I need to have all the nodes be able to ssh into each other (this is needed for other parts of the hadoop ecosystem).

I end up having to ssh into each node, then exit, then ssh into the next one, then exit, etc. Then repeat this on each node. Is there a way to do this faster?

Right now I am doing ssh -o StrictHostKeyChecking=no 127.0.0.1 which is better than having to type yes every time, but not ideal.

I'd prefer something like:

[command] localhost
[command] 127.0.0.1
[command] 0.0.0.0

That way I could just throw all the IP's in a script and run the script on every node and save myself a huge chunk of time and tedium.

Any thoughts?

Answers


Quite the trend of answering my own questions -

Here's something that works for me: I found you can pass commands with ssh in the format

ssh $host 'command1; command2; command3'

so I am just passing

ssh $host 'exit'

Need Your Help

Sha-bang line gives different result than calling the script manually

python shell

I have a Python script script.py that has been defined as executable and which begins with the following sha-bang:

copy database structure without data in mysql (with empty tables)

mysql copy database-schema

Is there any way to copy database structure without data in MySQL, so the new database will be the same as it is copied from, but with empty tables.

Download multiple files using JavaScript

javascript google-api

I'm very new to this so am learning by trial and error.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.