一,安装dsh
wget http://www.netfort.gr.jp/~dancer/software/downloads/libdshconfig-0.20.9.tar.gz tar xvf libdshconfig-0.20.9.tar.gz cd libdshconfig-0.20.9 ./configure --prefix=/usr/ make && make install wget http://www.netfort.gr.jp/~dancer/software/downloads/dsh-0.25.9.tar.gz tar xvf dsh-0.25.9.tar.gz cd dsh-0.25.9 ./configure --prefix=/usr/ make && make install ldconfig [root@heit]# dsh --help Distributed Shell / Dancer's shell version 0.25.9 Copyright 2001-2005 Junichi Uekawa, distributed under the terms and conditions of GPL version 2 -v --verbose Verbose output -q --quiet Quiet -M --show-machine-names Prepend the host name on output -H --hide-machine-names Do not prepend host name on output -i --duplicate-input Duplicate input given to dsh -b --bufsize Change buffer size used in input duplication -m --machine [machinename] Execute on machine -n --num-topology How to divide the machines -a --all Execute on all machines -g --group [groupname] Execute on group member -f --file [file] Use the file as list of machines -r --remoteshell [shellname] Execute using shell (rsh/ssh) -o --remoteshellopt [option] Option to give to shell -h --help Give out this message -w --wait-shell Sequentially execute shell -c --concurrent-shell Execute shell concurrently -F --forklimit [fork limit] Concurrent with limit on number -V --version Give out version information 这说明安装成功 ssh-keygen -t rsa 一路回车会在/root/.ssh/目录下生成公钥(id_rsa.pub)和私钥(id_rsa)。 将id_rsa.pub复制到被控制端/root/.ssh/目录下 mv id_rsa.pub authorized_keys chmod authorized_keys 600 在控制端 mkdir /root/.dsh/ mkdir /root/.dsh/group/ touch /root/.dsh/machines.list touch /root/.dsh/group/g1 cat //root/.dsh/machines.list 192.168.220.12 cat /root/.dsh/group/g1 192.168.220.12 dsh -r ssh -a touch /root/a dsh -r ssh -g g1 touch /root/a