æ¥ã
ã®ä½æ¥ã§è¤æ°ã®ãµã¼ãã«1å°1å°ãã°ã¤ã³ããã®ãããã©ãããï¼ï¼
ã¨ããå ´åã¯ãSSHã§ãã¹ã¯ã¼ããªããã°ã¤ã³ & sudoãã§ããããã«ãã¡ããã¨ããæãããã¾ãã
â»ã»ãã¥ãªãã£ãä½æ¥ãã¹æã®å½±é¿ç¯å²ãªã©ãååã«èæ
®ããå¿
è¦ãããã¾ãï¼ï¼ï¼
以ä¸ãCentOSã§ã®è¨å®æé ã§ã
管çãµã¼ãããåãµã¼ãã«éµãéã
[mikeda@admin ~]$ ssh-keygen Enterãªã©ãªã© [mikeda@admin ~]$ ssh-copy-id -i ~/.ssh/id_rsa.pub test-sv01 [mikeda@admin ~]$ ssh-copy-id -i ~/.ssh/id_rsa.pub test-sv02 ...
ï¼ãããã¯OSã¤ã³ã¹ãã¼ã«æã«.ssh/authorized_keysãç»é²ãã¨ãã¾ãããï¼
å¿
è¦ã§ããã°SSHã¯ã©ã¤ã¢ã³ãã®è¨å®ããããã¾ã
ã»ååãã°ã¤ã³æã«yes/noèãããªããªã
ã»ãµã¼ãå
¥ãæ¿ãçã§ãã¹ãã®ãã¼ã代ãã£ã¦ãã¨ã©ã¼çµäºããªããªã
[mikeda@admin ~]$ vi .ssh/config host * stricthostkeychecking no [mikeda@admin ~]$ chmod 600 .ssh/config
åãµã¼ãã§SSHçµç±ã§ãã¹ã¯ã¼ããªãsudoãå¯è½ã«ãã
[root@test-sv01 ~]# visudo #Defaults requiretty âã³ã¡ã³ãã¢ã¦ã mikeda ALL=(ALL) NOPASSWD:ALL
SSHã§sudoã§ããããã«ãªãã¾ãã
[mikeda@admin ~] $ ssh test-sv01 'hostname;sudo whoami' test-sv01 root
ãã¤ããã§ãããã»ãã¥ãªãã£ãä½æ¥ãã¹æã®å½±é¿ç¯å²ãªã©ãååã«èæ
®ããå¿
è¦ãããã¾ãï¼ï¼ï¼