To simplify the management of a group of computer we can use several linux tools.
1 Setting trusted authentication
You can login to a remote Linux server without entering password.
This section demonstrate how to do login from local-host to remote-host as user username without password.
In trusted environment we use the SSH keys to avoid put the password when connect via SSH.
Generate the pair private/public keys using ssh-key-gen on local-host.
su - username
Copy the public key to remote-host using ssh-copy-id.
ssh-copy-id -i ~/.ssh/id_rsa.pub remote-host
Now try logging into the machine, with ssh remote-host
SSH did not ask for password.
2 Using parallell ssh
First install the epel-release repository to have the pssh package available.
yum install epel-release
Install the package pssh
yum install pssh
Create a list of username@hostname in a file we name "grid.txt" like:
nuc00 nuc01 nuc02 nuc03 nuc04 nuc05 nuc06 nuc07 nuc08 nuc09 nuc10
Use pssh to run a command on the grid.
$ pssh -h grid.txt -l informix -A -i "date" Password: [PRESS ENTER TO VALIDATE USING SSH KEY]
Create a user account on all machines:
$ pssh -h grid.txt -l root -A -i "useradd hadoop" Password: [PRESS ENTER TO VALIDATE USING SSH KEY]
- Modify the user password on all machines:
$ pssh -h grid.txt -l root -A -i "echo 'hadoop' | passwd --stdin hadoop" Password: [PRESS ENTER TO VALIDATE USING SSH KEY]