Ubuntuã§sshdã®è¨å®ããã¦ãªã¢ã¼ãããæ¥ç¶ã§ããããã«ãã
sshdãµã¼ãã¹ã®éå§
éããã·ã³ãããã®Ubuntuãã·ã³ã«æ¥ç¶ãã¦ãããããã§ããã»ãã便å©ãªã®ã§sshdã®è¨å®ããã¦ããã
å
ãã¯ä»¥ä¸ã®ããã«ãã¦ã¤ã³ã¹ãã¼ã«ã
$ sudo aptitude install ssh
è¨å®ãã¡ã¤ã«ãè¦ãã¨ãrootã§ã®ãã°ã¤ã³ãæå¹ã«ãªã£ã¦ããã®ã§ãããç¡å¹ã«ãã¦ããã
$ sudo vi /etc/ssh/sshd_config PermitRootLogin no â noã«ãã¦ãã
ãã¨ã¯åºæ¬çã«ãã®ã¾ã¾ã§OKãPasswordAuthentication ã«ã¤ãã¦ã¯ç¾æ®µéã§ã¯ã¨ããããyesã«ãã¦ããããã¨ã§ä¸éãå ¬ééµã®ç»é²ãªã©ãçµãã£ããnoã«å¤æ´ãã¦ããã¹ã¯ã¼ãã«ãããã°ã¤ã³ãç¡å¹ã«ãã¦ãã¾ãã®ãããã
ã¨ãããããä¸è¨ã§è¨å®ãã¡ã¤ã«ã®å¤æ´ããã¦ããã®ã§ãsshdã®ãµã¼ãã¹ãåèµ·åãã¦ããã
ãµã¼ãã¹åèµ·åå¾ã¯å¿µã®ãããã¡ããã¨èµ·åãã¦ããã確èªãã¦ã¿ãã
$ sudo /etc/init.d/ssh restart $ sudo lsof -nPi:22 COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME sshd 10283 root 3u IPv4 49690 TCP *:22 (LISTEN)
ã¯ã©ã¤ã¢ã³ããã·ã³ï¼Linuxï¼ããã®æ¥ç¶
ç¶ãã¦ãLANå
ã«ãã1å°Linuxãã·ã³ãããã¨ãã¦ããã®ãã·ã³ããä»åsshdã®è¨å®ãããUbuntuãã·ã³ã«æ¥ç¶ãããã¨ããã
ããã§ã¯ãæ¥ç¶ãããã¨ãã¦ãããã·ã³ãã¯ã©ã¤ã¢ã³ãã
ä»åsshdã®è¨å®ãããUbuntuãã·ã³ããµã¼ã ã¨å¼ã¶ãã¨ã«ããã
ã¾ããã¯ã©ã¤ã¢ã³ãããµã¼ãå
±ã«chibiã¦ã¼ã¶ãåå¨ãã¦ãã¦ããã®chibiã¦ã¼ã¶ãæä½ãã¦ãããã®ã¨ãããï¼ã¦ã¼ã¶åã¯é©å®ç½®ãæãã¦ãã ããï¼
ã¯ã©ã¤ã¢ã³ããããµã¼ãã«sshã³ãã³ããçºè¡ããã°ããã¹ã¯ã¼ãã§ã®ãã°ã¤ã³ã¯è¨±å¯ãã¦ããã®ã§ãã¦ã¼ã¶ã¨ãã¹ã¯ã¼ããä¸è´ããã°åé¡ç¡ããã°ã¤ã³ã§ããã¨æãããªã®ã§ã次ã¯éµãå©ç¨ãã¦ã®ãã°ã¤ã³ããã¦ã¿ãã
ã¯ã©ã¤ã¢ã³ãå´ï¼ä»ã®Linuxãã·ã³ï¼ã§ä»¥ä¸ã®ã³ãã³ããå®è¡ãã¦éµã®çæãè¡ãã
$ ssh-keygen -t rsa
ãã¹ãã¬ã¼ãºã®å
¥åãä¿ãããããã¹ã¯ã¼ãã ã¨æã£ã¦ä½ãæååãæã¡è¾¼ãã§ããã
ãªããä½ãå
¥åããã«Enterãæ¼ãã°ã空ã®ãã¹ãã¬ã¼ãºã®éµãçæãããã¨ãã§ããã
以ä¸ã§ãã¯ã©ã¤ã¢ã³ãã®$HOME/.ssh/ 以ä¸ã« id_rsa, id_rsa.pub ãåºæ¥ä¸ããã
id_rsaãç§å¯éµã§ãid_rsa.pubãå
¬ééµã¨ãªããid_rsa.pubãæ¥ç¶ãããå
ã®ãµã¼ãã«ç»é²ãã¦ããã
id_rsaã¯ç§å¯éµãªã®ã§ããã®ãã·ã³ã§å¤§åã«æã£ã¦ããã
ã¨ããããããã®å ¬ééµï¼id_rsa.pubï¼ããµã¼ãã«éã£ã¦ããã
$ scp .ssh/id_rsa.pub ãµã¼ãã®IPã¢ãã¬ã¹:~/
ããã§ããµã¼ãå´ã®$HOMEã«ã¯ã©ã¤ã¢ã³ãã®id_rsa.pubã転éã§ããã®ã§ã以ä¸ã®ããã«ç»é²ãã¦ããã
以ä¸ã®ä½æ¥ã¯ãµã¼ãå´ï¼Ubuntuãã·ã³ï¼ã§ã®æä½ã¨ãªãã
$ mkdir .sshããããâ .ssh/ãã£ã¬ã¯ããªãç¡ãã£ãã®ã§ä½æãã $ cat id_rsa.pub >> .ssh/authorized_keys
以ä¸ã§å®äºãªã®ã§ãåã³ã¯ã©ã¤ã¢ã³ããããµã¼ãã¸sshã³ãã³ãã§æ¥ç¶ãã¦ã¿ãã
ä»åº¦ã¯éµæ¹å¼ã§ã®èªè¨¼ã«å¤ãã£ã¦ããããã¹ãã¬ã¼ãºã空ã§ç»é²ããå ´åã«ã¯ããã¹ã¯ã¼ãã®å
¥åãªã©ãä¸åãããã°ã¤ã³ãããã¨ãå¯è½ã«ãªãã
ãã¨ãæ®æ®µä½¿ç¨ãã¦ãããã·ã³ãWindowsã§ããã®Windowsãã·ã³ããæ¥ç¶ãããã¨ããå ´åã¯ãsshã¯ã©ã¤ã¢ã³ãã®ã½ããã使ãã°å¯è½ã
ã¡ãªã¿ã«åã¯ãPoderosa ã¨ããã½ããã使ç¨ãã¦ãã¾ãã
Windowsç¨ã®sshã¯ã©ã¤ã¢ã³ãã®ã½ããã«ãã£ã¦éµã®çæã®ä»æ¹ãªã©ã¯éãã®ã§ãããã§ã¯çç¥ããããåºæ¬çã«ã¯Linuxã¯ã©ã¤ã¢ã³ããã·ã³ã§ãã£ãä½æ¥ã¨å¤ããããéµãçæãããå
¬ééµããµã¼ãã«è»¢éãã¦ããããµã¼ãå´ã§ãã®å
¬ééµãç»é²ããã¨ããä½æ¥ã«ãªãã
ç»é²ããæã®æ³¨æç¹ã¨ãã¦ã¯ã$ cat id_rsa.pub >> .ssh/authorized_keys ã®ã>>ãã®é¨åã
ãããã>ãã¨ãã¡ãã£ããããã¨ãä»ã¾ã§ç»é²ããéµãæ¶ãã¡ããã®ã§æ³¨æã