netcatã使ã£ã¦è¸ã¿å°ãè¸ãæé ãçã
æå
å
¨å½ï¼åï¼åä¸ã®è¸ã¿å°ãµã¼ã好ãã®ã¿ãªãã¾
å
æ°ã«è¸ã¿å°ãµã¼ããè¸ã¾ãã¦ããã§ããããã
社å
ã§å©ç¨ãã¦ããªããããç解ãã¦ããªãã£ãã®ã§
æ¹ãã¦ã«ã¸ã¥ã¢ã«ã«å¦ã³ç´ããã¡ã¢ãæ¸ãã¦ããã¾ãã
åè
ã¯ã©ã¢ã³ã -> è¸ã¿å°ãµã¼ã -> 対象ãµã¼ã
ã¨ããæã«ãæ¯åè¸ã¿å°ãµã¼ãã«å ¥ã£ã¦ã対象ãµã¼ãã«å ¥ãã®ã¯é¢åãããã®ã§
ã~/.ssh/configãã¸
Host fumidai Hostname 203.0.113.1 User kenjiskywalker Host hoge-web01 Hostname 203.0.113.101 User kenjiskywalker ProxyCommand ssh fumidai nc -w 300 %h %p
ãã®ããã«è¨å®ãããã¨ã«ãã£ã¦
$ ssh hoge-web01
ãã®ã³ãã³ãã ãã§ãfumidaiãè¸ãã§hoge-web01ãµã¼ãã¸
ãã°ã¤ã³ãã¦ãããã®ã§ãããå®ã«å©ããã
è¸ã¿å°ãµã¼ãã.ssh/configã«è¨è¼ããªãå ´åã«æ°ãä»ããªãã¨ãããªãã®ã¯
Host hoge-web01 Hostname 203.0.113.101 User kenjiskywalker ProxyCommand ssh 203.0.113.1 nc -w 300 %h %p
ã¨ãã£ã¦ãã¾ã£ã¦ãã¨
Permission denied (publickey,gssapi-with-mic). ssh_exchange_identification: Connection closed by remote host
ã¨ã¨ã©ã¼ã«ãªã£ã¦ãã¾ããåå ã¯ç°¡åã§
ssh 203.0.113.1 => [email protected] ã¨ãããã¨ã§
è¸ã¿å°ãµã¼ãã®ãã°ã¤ã³ã¢ã«ã¦ã³ããæå®ãå¿ãã¦ããç¶æ
ã«ãªãã
ã¨ããã®ãï¼äººã§ãããã¼ã£ã¦ãã£ã¦ããæ¥ãããããã
è²ã
調ã¹ã¦ããã¨ãæè¿ã§ã¯netcat使ããããsshã®-Wãªãã·ã§ã³ä½¿ã人ãå¤ãã£ã½ãã
-wä»ããªãã¨å±
æ®ãçµãçºçããäºè±¡ããªãããè¸ã¿å°å´ã«netcatå
¥ããªãã¦ã
大ä¸å¤«ãªã®ã§ãããããå§ãã人ã¯ssh -Wã§è¯ãããã
netcat
Host hoge-web01 Hostname 203.0.113.101 User kenjiskywalker ProxyCommand ssh -l kenjiskywalker 203.0.113.1 nc -w 300 %h %p
ssh -W
Host hoge-web01 Hostname 203.0.113.101 User kenjiskywalker ProxyCommand ssh -W %h %p -l kenjiskywalker 203.0.113.1
ã¾ããåä¸ã»ã°ã¡ã³ãã«å¯¾ãã¦ã
ãã¹ãåãä¸æã«è¨å®ãã¦ãç¸äºèªèã§ããããã«ãã¦ããã°
Host fumidai Hostname 203.0.113.1 User kenjiskywalker Host hoge-* User kenjiskywalker ProxyCommand ssh fumidai nc -w 300 %h %p
ãããªæãã§æ¥½ãã§ããã£ã¦ç¥ã£ãã
@fujiwara++
netcatèªä½ã¯åå§çã§ãããæ
ã«å¼·åã§
çºæ³ããããã°è²ã
ã¨é¢ç½ããã¨ãã§ããã®ãããã
ä¸ï¼è¦ç´ ããµãã ãã«è©°ã¾ã£ã¦ããã®ãããã
( '~')