Friday 20 May 2011

Install and Configuration of PDSH

What's pdsh?
                       Pdsh is a an efficient, multithreaded remote shell client which executes commands on multiple remote hosts in parallel.
                      
                      Pdsh implements dynamically loadable modules for extended functionality such as new remote shell services and remote host selection.

Steps to Install and Configure:

    1. Install pdsh on the Server.

    2. Import ssh key of Server1 to the node1 and node2.

    3. Add hostname-to-IPaddress of node1/node2 in /etc/hosts on Server1.

    4. To execute: pdsh -w ssh:root@node[1,2] ls 2> /dev/null then node1 and node2 will to execute ls command and report to the Server1 as following:

    lawrence@suse:~/.ssh> pdsh -w ssh:root@node[1,2] ls 2> /dev/null
    node1: anaconda-ks.cfg
    node1: Desktop
    node1: id_rsa.pub
    node1: install.log
    node1: install.log.syslog
    node2: anaconda-ks.cfg
    node2: bin
    node2: conf-examples
    node2: cpulimit-1.1.tar.gz
    node2: cpulimit.tar.gz
    node2: Desktop
    node2: id_rsa.pub
    node2: install.log
    node2: install.log.syslog
    node2: mibs
    node2: mibs_20100925.rar

    5. Combine multiple commands:
    lawrence@suse:~/.ssh> pdsh -w ssh:root@node[1,2] "cd /tmp;ls" 2> /dev/null
    node1: pulse-Bk60xcI9xlDq
    node1: virtual-root.pHV8bR
    node2: etherXXXXWj7KYw
    node2: gconfd-root
    node2: keyring-RdVKdK
    node2: mapping-root
    node2: scim-panel-socket:0-root

Remote login without password:

    Step 1: Create public and private keys using ssh-key-gen on local-host


    jsmith@local-host$ ssh-keygen


    Step 2: Copy the public key to remote-host using ssh-copy-id

    jsmith@local-host$ ssh-copy-id -i ~/.ssh/id_rsa.pub remote-host

or

    jsmith@local-host$ scp -r ~/.ssh/id_rsa.pub 151.8.19.146:/root/.ssh/authorized_key

    jsmith@remote-host's password:
    Now try logging into the machine, with "ssh 'remote-host'", and check in:

    .ssh/authorized_keys

    to make sure we haven't added extra keys that you weren't expecting.

    Note: ssh-copy-id appends the keys to the remote-host’s .ssh/authorized_key.

    Step 3: Login to remote-host without entering the password

    jsmith@local-host$ ssh remote-host.

And also Set up the Passwordless Remote Login .











No comments:

Post a Comment