Back in the September of the previous year, I put out a post with the procedure outlining the process of setting a password-less logins to other AIX hosts. This very procedure can also be applied to whatever OS it is as long as it supports
Today, I had to harvest CPU/RAM information from a large number of LINUX machines and I decided to use the same procedure – I will set one LINUX host so from it I will be able log-in with no password or execute a command also without being asked to authenticate. As I was happily getting started with my tasks, Mike the Red Fedora wearer (really he comes to the office wearing a red fedora) Swierczynski (“ski” for short) entered my cube and after a glance at my screen asked me if I am aware that LINUX has a better tool for the task at hand. What is it Mike?
“LINUX has a command called
ssh-copy-id that works for LINIX to LINUX to AIX to SOLARIS, and which will/can set the whole environment so even if a target hosts does not have the
.ssh setup in the user’s home directory this command will make sure this entities will be created and populated so the user will not be asked to authenticated at login or at the instant of a command executed remotely on his behalf and carried by SSH.”
In my case, to enable a passwordless root login from
hostB, I executed the following command
# ssh-copy-id -i ~root/.ssh/id_rsa.pub rootB@host_name
Actually this command became a body of a
for loop which was fed with host names from a file (some twenty or more) called
hostA# for host in `cat hostsList`; do ssh-copy-id -i .ssh/id_rsa.pub root@$host; done
I almost forgot, Mike also showed me the
dmidcode which spits out page after page of info which usefulness I have yet to learn.
By the way, the id_rsa.pub file was created with the same command as in September:
# ssh-keygen -t rsa
a good day everybody