¡¡Linuxϵͳ¹ÜÀíÔ±¶¼Çå³þ¡°°²È«Íâ¿Ç¡±ÐÒéÊÇÈí¼þ¹¤¾ß°üÖÐ×î±ãÀûÒ²ÊÇ×î¹Ø¼üµÄ¹¤¾ßÖ®Ò»¡£±¾ÎĽ«Ïò´ó¼Ò½éÉÜÒ»¸ö±»³Æ×÷OpenSSHµÄ¿ªÔ´SSHÊÇÈçºÎ¹¤×÷µÄ£¬ÒÔ¼°Ëü¶ÔÓÚLinuxϵͳ»·¾³µÄÖØÒªÒâÒå¡£
SSH¿ÉÒÔͨ¹ýÍøÂç¹ÜÀíÍâ¿Ç»òPerl½Å±¾°²È«¿ìËÙʵÏÖÒ»´ÎÐÔ×Ô¶¯¹ÜÀí¶ą̀·þÎñÆ÷¡£µ±È»£¬ÆäËûÍøÂçÍâ¿Ç¹¤¾ßÀýÈçRSH£¬³öÏÖµÄʱ¼ä±ÈSSH¸ü¾Ã¡£µ« SSHΪÁËÎļþÔÚÍøÂçÉÏ°²È«´«Ê䣬¼ÓÈëÁËÇ¿´óµÄ¼ÓÃܺÍÊý¾ÝѹËõ¹¦ÄÜ£¬´ó²¿·ÖÁ÷ÐеÄSSHÉõÖÁ»¹ÌṩÁËSFTPºÍSCP¹¦ÄÜ¡£ÔÚÖÚ¶àSSHÖУ¬×îÁ÷ÐеľÍÊÇÓÉOpenBSDÉçÍÅÖ÷³Ö¿ª·¢ºÍά»¤µÄOpenSSHÏîÄ¿¡£OpenSSH¿ÉÒÔÓÃÔÚÄ¿Ç°¼¸ºõËùÓеIJÙ×÷ϵͳƽ̨ÉÏ£¬°üÀ¨Î¢ÈíWindows.
SSHµÄ×÷ÓÃ
SSHͨ¹ýÇ¿´óµÄ¼ÓÃܹ¦Äܱ£»¤ÍêÕûµÄÔ¶³ÌÍâ¿ÇÏ̲߳»±»ºÚ¿ÍºÍ¶ñÒâÈí¼þÈëÇÖ¡£¶Ëµ½¶ËµÄ±£»¤ÄÜÁ¦¿ÉÒÔ´ÓÏ߳̿ªÊ¼µ½½áÊøÌṩÍêÕûµÄ±£»¤£¬ËäÈ»ÊÜÐÅÖ÷»úÈÏÖ¤·½°¸ÒÔ¼°ÏµÍ³¼äµÄÔ¤ÏÈÃÜÔ¿½»»»ÓÐÖúÓÚÌá¸ß°²È«ÐÔ£¬µ«ÊÇOpenSSH²¢²»ÐèÒªÖ¤Êé»òÕßÔ¤ÏÈÃÜÔ¿½»»»À´È·Á¢Ò»¸ö¼ÓÃܵÄÔ¶³ÌÏ̡߳£
ÁíÍ⣬SSH¿ÉÒÔͨ¹ýSFTP¹¦ÄÜʹµÃÀàËÆFTPµÄÎļþ´«ÊäÏ߳̾ßÓмÓÃÜÄÜÁ¦£¬Í¬Ê±¿ÉÒÔÈÃÓû§µÄÃÜÂëÒÔ¼°Óû§ÃûÒÔ¼ÓÃÜ·½Ê½´«Ê䣬¶ø·ÇÃ÷ÎÄ·½Ê½´«Êä¡£¶ÔÓÚÏÞÖƸü¶àµÄÇé¿ö£¬Èçµ¥Ò»Îļþ´«Êä²Ù×÷£¬SCPͬÑù¿ÉÒÔʵÏÖ°²È«ºÍ·½±ãµÄ´«ÊäÄÜÁ¦£¬Ëü»áͨ¹ýÒ»¸ö¼ÓÃܵÄÎļþ¿½±´ÃüÁîʵÏÖÎļþÔÚÍøÂçÉϵĴ«Êä¡£
ʹÓúÍÅäÖÃLinux¿Í»§¶Ë
½«OpenSSH°²×°µ½Ö÷Á÷LinuxϵͳÖзdz£¼òµ¥£¬Ö»ÐèÒªÒ»¸ö¼òµ¥µÄ°ü¹ÜÀíÃüÁî¡£±ÈÈçÒªÔÚDebian GNU/LinuxÖа²×°OpenSSH£¬Ö»ÐèÒªÒÔrootÉí·ÝµÇ¼£¬²¢ÔÚÃüÁîÐз½Ê½ÊäÈëapt-get install ssh.ͬÑù£¬ÔÚFedora Core LinuxÖУ¬Ò²Ö»ÐèÒªÒÔrootÉí·ÝµÇ¼£¬²¢ÊäÈëyum install ssh¼´¿É¡£²»¹ýÒ»°ãÇé¿öÏ£¬ÕâÁ½¸öÃüÁîÐÐÒ²²»ÐèÒª£¬ÒòΪDebianºÍFedora CoreÖУ¬ÒѾĬÈÏ°²×°ÁËOpenSSH.¶ÔÓÚÈκÎLinuxϵͳ£¬Èç¹ûÄãÏë²é¿´ËüÊÇ·ñ°²×°ÁËOpenSSH£¬Ö»ÐèÒª¼òµ¥µØÊäÈëssh¼´¿É¡£»Ø³µºó£¬Èç¹ûϵͳÒѾ°²×°ÁËOpenSSH£¬Ôò»á·µ»ØÓйØOpenSSHµÄÍêÕûʹÓÃÐÅÏ¢¡£
ҪʹÓÃOpenSSH¿Í»§¶Ëͨ¹ýÃüÁîÐз½Ê½½ÓÈëÔËÐÐOpenSSH·þÎñÆ÷¶ËµÄϵͳ£¬Ò»°ãÖ»ÐèÒªÊäÈëssh host£¬ÕâÀïµÄhostÊÇָĿ±êϵͳµÄÖ÷»úÃû¡£Èç¹ûÍøÂçûÓÐDNS½âÎö£¬»òÕßÖ÷»úÃûûÓÐÔÚ/etc/hostsÎļþÖÐÁгö£¬ÄÇôÔòÐèÒªÖ±½ÓÊäÈë¶Ô·½Ö÷»úµÄIPµØÖ·£¬±ÈÈçssh 192.168.0.1.
OpenSSHϵͳ·¶Î§µÄÅäÖÃÎļþÒ»°ãλÓÚ/etc/sshĿ¼Ï¡£OpenSSH¿Í»§¶ËµÄÖ÷ÒªÅäÖÃÎļþΪ/etc/ssh/ssh_config .´ó²¿·Ö°æ±¾µÄOpenSSH¶¼ÔÚÅäÖÃÎļþÖдøÓÐÏêϸµÄ×¢ÊÍ¡£ÔÚһЩ·¢ÐÐÁ¿½Ï´óµÄLinuxϵͳÖУ¬±ÈÈçDebian£¬Äã¿ÉÒÔͨ¹ýÃüÁîÐÐman ssh_configÀ´»ñÈ¡¸ü¶àÓйØOpenSSH¿Í»§¶ËµÄÅäÖÃÐÅÏ¢¡£
°²È«·½ÃæµÄÒ»¸öÖ÷ÒªÅäÖÃÏîÄ¿¾ÍÊÇForwardX11£¬½«Õâ¸öÑ¡ÏîÉèÖÃΪ¡°no¡±£¬¿ÉÒÔ·ÀÖ¹OpenSSH¿Í»§¶Ë×Ô¶¯ÏòÍøÂç·¢ËÍX Window SystemÐÅÏ¢£¬·ñÔò¾ÍËãûÓÐÔÚSSHÁ´½ÓÉÏʹÓÃX Windows£¬ÓйØÐÅÏ¢»¹ÊÇÓпÉÄܱ»·¢ËÍ¡£ÔÚÕâ¸öÑ¡ÏîÖУ¬Äã¿ÉÒÔͨ¹ý-XÃüÁîÐвÎÊýÀ´Ö¸¶¨Ä³¸öÌض¨µÄSSHÁ¬½Ó¿ÉÒÔ·¢ËÍX WindowϵͳÐÅÏ¢¡£etc/ssh/ssh_configÎļþÖеÄÆäËüÅäÖÿÉÒÔ°ïÖúÄãʵÏÖ»òÕß¼ÓÇ¿ÍøÂ簲ȫ²ßÂÔ£¬Âú×ãijЩÌض¨µÄ°²È«ÐèÇó¡£
»ùÓÚWindowsµÄSSH¿Í»§¶Ë
WindowsϵͳϵÄSSH¿Í»§¶ËÏ൱¶à£¬ÆäÖÐijЩÊôÓÚÉÌÒµ»¯Èí¼þ£¬ÆäÓàÔòÊÇÃâ·ÑÈí¼þ»ò¹²ÏíÈí¼þ£¬µ±È»Ò²ÓÐOpenSSHÕâÑùµÄ¿ª·ÅÔ´´úÂëÈí¼þ¡£ËäÈ»ÆäÖÐÓÐЩÈí¼þÊôÓÚUnixÄ£ÄâÆ÷Íâ¿ÇµÄÒ»²¿·Ö£¬ÈÔÈ»ÊÇÃüÁîÐз½Ê½µÄ¿Í»§¶Ë£¬µ«ÊǴ󲿷ֶ¼ÒѾÅäºÏWindowsϵͳ¿ª·¢³öÁËͼÐνçÃæ¡£ÔÚÕâЩ´øÓÐͼÐνçÃæµÄÃâ·ÑÈí¼þÖУ¬WinSCPÖ§³ÖSCP ºÍ SFTP£¬PuTTYÖ§³ÖSSH Íâ¿Ç¡£ÔÚ¿´¹ýÉÏÃæÓйØLinuxÏÂOpenSSH¿Í»§¶ËµÄʹÓ÷½·¨ºó£¬Äã»á·¢ÏÖ´øÓÐͼÐνçÃæµÄWinSCPºÍPuTTYÔÚÅäÖúÍʹÓÃÉ϶¼·½±ãÒ׶®ÁËÐí¶à¡£ WindowsϵÄOpenSSH£¬Ò²±»³Æ×÷OpenSSH for Windows £¬Í¬ÑùÖ§³Ö¶Ë¿ÚÉ趨¡£
ÔÚLinuxÏÂʹÓúÍÅäÖÃOpenSSH·þÎñÆ÷
Ò»°ãÇé¿öÏ£¬ÄãµÄLinuxϵͳÉÏ¿ÉÄÜÒѾÔËÐÐÁËOpenSSH·þÎñÆ÷¶Ë¡£ÔÚDebian GNU/Linux ϵͳÖУ¬OpenSSH·þÎñÆ÷¶Ë¿ÉÒÔͨ¹ýÒÔÏÂÃüÁîÐз½Ê½ÖØÐÂÆô¶¯£º /etc/init.d/ssh restart.½«ÃüÁîÐÐÖеġ°restart¡± ¸ÄΪ ¡°start¡± »ò ¡°stop¡±£¬¾Í¿ÉÒÔʵÏÖÆô¶¯ºÍÍ£Ö¹OpenSSH·þÎñÆ÷ÁË¡£ÔÚFedora Core LinuxϵͳÖУ¬ÃüÁʽҲÊÇÒ»Ñù£¬Ö»²»¹ýÊǽ«ÉÏÃæµÄ¡°ssh¡±¸ÄΪÁË¡°sshd¡±¡£
ÓëOpenSSH¿Í»§¶ËÅäÖÃÎļþÀàËÆ£¬OpenSSH·þÎñÆ÷¶ËµÄÅäÖÃÎļþÒ»°ãΪ/etc/ssh/sshd_config£¬ËüµÄ¸ñʽÓë /etc/ssh/ssh_config»ù±¾Ò»Ñù£¬µ«ÊÇÆäÖеÄÑ¡ÏîÊDz»Í¬µÄ£¬ÅäÖÃÎļþµÄϸ½Ú¿ÉÒÔͨ¹ýman sshd_configÃüÁî²é¿´¡£Ò»°ãÇé¿öÏ£¬Ó¦¸Ã½«UsePrivilegeSeparationºÍIgnoreRhostsÑ¡ÏîÉèÖÃΪ¡°yes¡±£¬½« PermitRootLoginºÍPermitEmptyPasswordsÉèÖÃΪ¡°no¡±¡£ÓëÔÚOpenSSH¿Í»§¶ËÒ»Ñù£¬Èç¹ûÔÊÐíÔÚSSHÁ¬½ÓÉÏ·¢ËÍ WindowsϵͳÐÅÏ¢£¬½«µ¼ÖÂÇá΢µÄ°²È«·çÏÕ£¬Òò´ËÈç¹ûûÓбØÒª£¬²»±Ø¼¤»î¸ÃÑ¡ÏͬÑù£¬ÔÚ·þÎñÆ÷¶ËÒ²Ó¦¸Ã½«X11ForwardingÉèÖÃΪ ¡°no¡±¡£
¶ÔÓھ߱¸°²È«ÒâʶµÄLinuxÓû§£¬¸üÓ¦¸ÃÕýÈ·ÉèÖÃÒÔÉϼ¸¸öOpenSSH·þÎñÆ÷¶ËÑ¡Ïî¡£³£¼ûµÄÀýÍâ¿ÉÄÜ°üÀ¨PermitRootLoginºÍX11ForwardingÅäÖÃÑ¡Ïî¡£
ʹÓÃOpenSSH
OpenSSH´øÓжàÏîSSHËù²»¾ß±¸µÄ¹¦ÄÜ£¬ÀýÈ磬ÆäËüÍøÂçÐÒé¿ÉÒÔÔÚOpenSSHÐÒéÖн¨Á¢¡°Í¨µÀ¡±£¬´Ó¶øÌṩÔöÇ¿µÄ°²È«ÐÔ£¬Èç±¾ÎÄÖÐÌáµ½µÄÔÚSSHÁ¬½ÓÉÏʹÓÃWindow System£»ssh-agentµÈ¹¤¾ß¿ÉÒÔÈÃOpenSSH¿Í»§¶ËµÄ¹ÜÀíºÍʹÓñäµÃ¸ü¼òµ¥£»ÁíÍâһЩ²»Ïà¹ØµÄ¹¤¾ßÒ²¿ÉÒÔÖ§³ÖSSHͨµÀ£¬ÀýÈç Subversion°æ±¾¿ØÖÆϵͳ¡£
ʹÓÃÍøÂçÉ϶ą̀¼ÆËã»úµÄLinuxÐÂÓû§Ò²ÐíÎÞ·¨ÂíÉÏÌå»áµ½SSHµÄ¼ÛÖµ£¬ÕâЩÐÂÓû§ÒÔÇ°´ó²¿·Ö¶¼ÊÇ΢ÈíWindowsϵͳµÄÓû§¡£ÔÚ WindowsϵͳÖУ¬ÓйØϵͳµÄÉèÖÃÊÇÕë¶Ô±¾µØÓû§½øÐÐÓÅ»¯µÄ£¬Òò´ËÔ¶³Ì½øÐйÜÀí²¢²»·½±ã¡£¾ÍËãÊÇÔÚ·þÎñÆ÷¹ÜÀíÒÔ¼°Ô¶³Ì¼¼ÊõÖ§³Ö·½Ã棬ͨ¹ýÖîÈç Windows Remote DesktopÒÔ¼°Terminal Services for WindowsµÈ¹¤¾ßËùʵÏֵĹÜÀí¹¦ÄÜÒ²ÊÇÓÐÏ޵ģ¬¶øÇÒͨ¹ýÍøÂç·ÃÎÊWindows×ÊÔ´×ÜÊDz»Ì«Ö±½Ó¡£
Ïà·´£¬Linux³¤ÆÚÓû§»áÔÚÒ»¸öµ¥¶ÀµÄϵͳÉÏ°²×°ÈÕ³£¹¤×÷ËùÐèµÄÓ¦ÓÃÈí¼þ£¬ËûÃÇͨ¹ýÒ»¸öÓ²¼þÅäÖýϵ͵Äϵͳ£¬Í¨¹ýSSHÁ¬½Óµ½Õâ¸öµ¥¶ÀµÄϵͳÉϲ¢ÔËÐÐÈí¼þ¡£Êµ¼ÊÉÏ£¬ºÜ¶àLinuxϵͳ¹ÜÀíÔ±»áÕûÌì×øÔÚµçÄÔÇ°¹¤×÷£¬¶øËûÃÇËù½øÐеIJÙ×÷£¬ÀýÈçÊÕ·¢µç×ÓÓʼþ£¬Êéд¹¤×÷ÈÕÖ¾»òÕß±à³ÌµÈ¹¤×÷ËùʹÓõĵçÄÔÉõÖÁ²»ÔÚͬһ¶°´óÂ¥ÄÚ¡£ÔÚÖð½¥ÉîÈëÁ˽âSSHµÄÓŵãÖ®ºó£¬Óû§Ê¹ÓÃSSH¾Í»á¸ü¼ÓµØµÃÐÄÓ¦ÊÖ£¬²¢ÇÒ¸üÐÅÈÎSSH.¶øÄÇЩ¸Õ¸ÕÊìϤLinuxϵͳµÄÓû§£¬¶Ìʱ¼äÄÚ»¹²»ÄܺܿìÀí½âSSHΪ¹¤×÷ЧÂÊ´øÀ´µÄÌáÉý¡£
ÅäÖúÍʹÓÃOpenSSHÊÇÒ»¼þ¶ÔδÀ´¹¤×÷ЧÂÊÌáÉý·Ç³£ÓаïÖú¹¤×÷£¬¾¡¹ÜÄ¿Ç°¿ÉÄÜ»¹ÎÞ·¨Á¢¼´¿´µ½ÊÕÒæ¡£¼ÙÒÔʱÈÕ£¬Ä㽫»á»³ÒÉÈç¹ûûÓÐSSH»¹ÄÜ·ñÕý³£¹¤×÷¡£
ͨ¹ýÔÚ¹¤×÷Õ¾µÄWindows»·¾³ÔËÐжàÖÕ¶ËÄ£ÄâÆ÷£¬»òÕßͨ¹ýScreen¹¤¾ß£¬Linux»òÆäËüUnixϵͳ¹ÜÀíÔ±¶¼¿ÉÒÔÇáËɵØͬʱ¹ÜÀí¶à¸öϵͳ¡£SSH¿ÉÒÔͨ¹ýÍøÂç¹ÜÀíÍâ¿Ç»òPerl½Å±¾°²È«¿ìËÙʵÏÖÒ»´ÎÐÔ×Ô¶¯¹ÜÀí¶ą̀·þÎñÆ÷¡£