명령어 하나로 여러대 자원 관리하기 (SSH 인증키 사용) |
문제의 요점은 여러대의 동일한 시스템을 관리하는데 있어서 반복되는 작업이 잦다는것.. [root@localhost ~]# ssh-keygen -t rsa
Generating public/private rsa key pair. Enter file in which to save the key (/root/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /root/.ssh/id_rsa. Your public key has been saved in /root/.ssh/id_rsa.pub. The key fingerprint is: ea:24:ca:36:af:99:e6:4f:96:d2:b6:0f:25:75:fc:ea mojily@chonnom.com ※ -t : type Specify type of key to create. [root@localhost .ssh]# scp id_rsa.pub root@xxx.xxx.xxx.xxx:/root/.ssh/authorized_keys
root@xxx.xxx.xxx.xxx's password: id_rsa.pub 100% 397 0.4KB/s 00:00
[root@localhost .ssh]# ls -al
total 24 drwxr-xr-x 2 root root 4096 Jan 26 11:29 . drwxr-x--- 5 root root 4096 Jan 26 11:29 .. -rw-r--r-- 1 root root 397 Jan 26 11:29 authorized_keys
[root@mojily .ssh]# ssh -lroot xxx.xxx.xxx.xxx
Last login: Tue Jan 26 11:32:28 2010 from xxx.xxx.xxx.xxx [root@localhost ~]#
function get_nodes_1
{ cat <<EOF 192.168.0.111 192.168.0.112 EOF } function get_nodes_2 function get_nodes_3 case "$1" in sh) echo "###########################################" echo -n "Select Center Number ^^;; : " get_nodes_$num | while read server ; do help) # sh 옵션을 통해서 명령어 전달!! $0 sh "$1" ※ usage: ssh [-1246AaCfgkMNnqsTtVvXxY] [-b bind_address] [-c cipher_spec] [root@localhost ]# ./remote_controal.sh 'hostname; date' ########################################### SK1 Tue Jan 26 11:24:27 KST 2010 SK2 Tue Jan 26 11:24:27 KST 2010 |
2010년 4월 8일 목요일
명령어 하나로 여러대 자원 관리하기 (SSH 인증키 사용)-[펌]
피드 구독하기:
댓글 (Atom)
댓글 없음:
댓글 쓰기