配置ssh免密碼登錄bash
若是是簡單執行幾個命令,則:ssh
ssh user@remoteNode "cd /home ; ls"
基本能完成經常使用的對於遠程節點的管理了,幾個注意的點:spa
有些遠程執行的命令內容較多,單一命令沒法完成,考慮腳本方式實現:code
#!/bin/bash ssh user@remoteNode > /dev/null 2>&1 << eeooff cd /home touch abcdefg.txt exit eeooff echo done!
遠程執行的內容在「<< eeooff 」 至「 eeooff 」之間,在遠程機器上的操做就位於其中,注意的點:rem