Cygwin-安装和配置ssh服务

来源:互联网 发布:常用的网络通信协议 编辑:程序博客网 时间:2024/05/16 19:21

Cygwin介绍:

Cygwin是一个在windows平台上运行的类UNIX模拟环境,它对于学习UNIX/Linux操作环境,或者从UNIX到Windows的应用程序移植,或者进行某些特殊的开发工作,尤其是使用GNU工具集在Windows上进行嵌入式系统开发,非常有用。

因为要学习hadoop分布式文件系统,想在window下模拟linux环境进行部署。所以想到用cygwin工具。

先将几个我在安装过程中遇到的问题:

1.安装时最好明确自己要安装那些服务,根据自己的实际需要而定,我一次安装就因为漏选了openssh,后来重装了,

2.重装可以不用先卸载,直接点击setup.exe,进行安装,

3.那个选择下载站点就选默认的就好了http://mirrons.163.com。

4.安装ssh服务时配置无密码是总是出错

错误如下:删掉.ssh文件夹,用密码登陆也是不成功。试了好几次,也重装了cygwin64位还是无效,最后安装cygwin32位的才可以。

[java] view plaincopyprint?
  1. Administrator@L ~  
  2. $  cd ~/.ssh  
  3.   
  4. Administrator@L~/.ssh  
  5. $ ssh localhost  
  6. Administrator@localhost's password:  
  7.       2 [main] sshd 3804 D:\SofeWare\cygwin\usr\sbin\sshd.exe: *** fatal error - NtCreateEvent(lock): 0xC0000058  
  8. Connection to localhost closed.  

注意配置 ssh的时候,yes/no的选择要小心点,不小心就会出错。

[java] view plaincopyprint?
  1. Administrator@L ~  
  2. $ ssh-host-config  
  3.   
  4. *** Info: Generating missing SSH host keys  
  5. ssh-keygen: generating new host keys: RSA1 RSA DSA ECDSA ED25519  
  6. *** Info: Creating default /etc/ssh_config file  
  7. *** Info: Creating default /etc/sshd_config file  
  8.   
  9. *** Info: StrictModes is set to 'yes' by default.  
  10. *** Info: This is the recommended setting, but it requires that the POSIX  
  11. *** Info: permissions of the user's home directory, the user's .ssh  
  12. *** Info: directory, and the user's ssh key files are tight so that  
  13. *** Info: only the user has write permissions.  
  14. *** Info: On the other hand, StrictModes don't work well with default  
  15. *** Info: Windows permissions of a home directory mounted with the  
  16. *** Info: 'noacl' option, and they don't work at all if the home  
  17. *** Info: directory is on a FAT or FAT32 partition.  
  18. *** Query: Should StrictModes be used? (yes/no) no  
  19.   
  20. *** Info: Privilege separation is set to 'sandbox' by default since  
  21. *** Info: OpenSSH 6.1.  This is unsupported by Cygwin and has to be set  
  22. *** Info: to 'yes' or 'no'.  
  23. *** Info: However, using privilege separation requires a non-privileged account  
  24. *** Info: called 'sshd'.  
  25. *** Info: For more info on privilege separation read /usr/share/doc/openssh/README.privsep.  
  26. *** Query: Should privilege separation be used? (yes/no) no  
  27. *** Info: Updating /etc/sshd_config file  
  28.   
  29. *** Query: Do you want to install sshd as a service?  
  30. *** Query: (Say "no" if it is already installed as a service) (yes/no) yes  
  31. *** Query: Enter the value of CYGWIN for the daemon: [] ntsec  
  32. *** Info: On Windows Server 2003, Windows Vista, and above, the  
  33. *** Info: SYSTEM account cannot setuid to other users -- a capability  
  34. *** Info: sshd requires.  You need to have or to create a privileged  
  35. *** Info: account.  This script will help you do so.  
  36.   
  37. *** Info: It's not possible to use the LocalSystem account for services  
  38. *** Info: that can change the user id without an explicit password  
  39. *** Info: (such as passwordless logins [e.g. public key authentication]  
  40. *** Info: via sshd) when having to create the user token from scratch.  
  41. *** Info: For more information on this requirement, see  
  42. *** Info: https://cygwin.com/cygwin-ug-net/ntsec.html#ntsec-nopasswd1  
  43.   
  44. *** Info: If you want to enable that functionality, it's required to create  
  45. *** Info: a new account with special privileges (unless such an account  
  46. *** Info: already exists). This account is then used to run these special  
  47. *** Info: servers.  
  48.   
  49. *** Info: Note that creating a new user requires that the current account  
  50. *** Info: have Administrator privileges itself.  
  51.   
  52. *** Info: No privileged account could be found.  
  53.   
  54. *** Info: This script plans to use 'cyg_server'.  
  55. *** Info: 'cyg_server' will only be used by registered services.  
  56. *** Query: Do you want to use a different name? (yes/no) no  
  57. *** Query: Create new privileged user account 'LYX\cyg_server' (Cygwin name: 'cyg_server')? (yes/no) no  
  58. *** ERROR: There was a serious problem creating a privileged user.  
  59. *** Query: Do you want to proceed anyway? (yes/no) no  
  60.   
  61. Administrator@L ~  
  62. $ ssh-host-config  
  63.   
  64. *** Info: Generating missing SSH host keys  
  65. *** Query: Overwrite existing /etc/ssh_config file? (yes/no) yes  
  66. *** Info: Creating default /etc/ssh_config file  
  67. *** Query: Overwrite existing /etc/sshd_config file? (yes/no) yes  
  68. *** Info: Creating default /etc/sshd_config file  
  69.   
  70. *** Info: StrictModes is set to 'yes' by default.  
  71. *** Info: This is the recommended setting, but it requires that the POSIX  
  72. *** Info: permissions of the user's home directory, the user's .ssh  
  73. *** Info: directory, and the user's ssh key files are tight so that  
  74. *** Info: only the user has write permissions.  
  75. *** Info: On the other hand, StrictModes don't work well with default  
  76. *** Info: Windows permissions of a home directory mounted with the  
  77. *** Info: 'noacl' option, and they don't work at all if the home  
  78. *** Info: directory is on a FAT or FAT32 partition.  
  79. *** Query: Should StrictModes be used? (yes/no) yes  
  80.   
  81. *** Info: Privilege separation is set to 'sandbox' by default since  
  82. *** Info: OpenSSH 6.1.  This is unsupported by Cygwin and has to be set  
  83. *** Info: to 'yes' or 'no'.  
  84. *** Info: However, using privilege separation requires a non-privileged account  
  85. *** Info: called 'sshd'.  
  86. *** Info: For more info on privilege separation read /usr/share/doc/openssh/README.privsep.  
  87. *** Query: Should privilege separation be used? (yes/no) no  
  88. *** Info: Updating /etc/sshd_config file  
  89.   
  90. *** Query: Do you want to install sshd as a service?  
  91. *** Query: (Say "no" if it is already installed as a service) (yes/no) yes  
  92. *** Query: Enter the value of CYGWIN for the daemon: [] netsec  
  93. *** Info: On Windows Server 2003, Windows Vista, and above, the  
  94. *** Info: SYSTEM account cannot setuid to other users -- a capability  
  95. *** Info: sshd requires.  You need to have or to create a privileged  
  96. *** Info: account.  This script will help you do so.  
  97.   
  98. *** Info: It's not possible to use the LocalSystem account for services  
  99. *** Info: that can change the user id without an explicit password  
  100. *** Info: (such as passwordless logins [e.g. public key authentication]  
  101. *** Info: via sshd) when having to create the user token from scratch.  
  102. *** Info: For more information on this requirement, see  
  103. *** Info: https://cygwin.com/cygwin-ug-net/ntsec.html#ntsec-nopasswd1  
  104.   
  105. *** Info: If you want to enable that functionality, it's required to create  
  106. *** Info: a new account with special privileges (unless such an account  
  107. *** Info: already exists). This account is then used to run these special  
  108. *** Info: servers.  
  109.   
  110. *** Info: Note that creating a new user requires that the current account  
  111. *** Info: have Administrator privileges itself.  
  112.   
  113. *** Info: No privileged account could be found.  
  114.   
  115. *** Info: This script plans to use 'cyg_server'.  
  116. *** Info: 'cyg_server' will only be used by registered services.  
  117. *** Query: Do you want to use a different name? (yes/no) yes  
  118. *** Query: Enter the new user name: l  
  119. *** Query: Reenter: l  
  120.   
  121. *** Query: Create new privileged user account 'LYX\lyx' (Cygwin name: 'l')? (yes/no) yes  
  122. *** Info: Please enter a password for new user lyx.  Please be sure  
  123. *** Info: that this password matches the password rules given on your system.  
  124. *** Info: Entering no password will exit the configuration.  
  125. *** Query: Please enter the password:  
  126. *** Query: Reenter:  
  127.   
  128. *** Warning: Creating the user 'l' failed!  Reason:  
  129. ▒û▒▒▒▒▒▒▒▒▒▒▒▒ƿ▒▒Բ▒ͬ▒▒  
  130.   
  131. ▒▒▒▒▒ NET HELPMSG 2253 ▒Ի▒ø▒▒▒İ▒▒▒▒▒  
  132.   
  133.   
  134. *** ERROR: There was a serious problem creating a privileged user.  
  135. *** Query: Do you want to proceed anyway? (yes/no) yes  
  136. *** Warning: Expected privileged user 'lyx' does not exist.  
  137. *** Warning: Defaulting to 'SYSTEM'  
  138.   
  139. *** Info: The sshd service has been installed under the LocalSystem  
  140. *** Info: account (also known as SYSTEM). To start the service now, call  
  141. *** Info: `net start sshd' or `cygrunsrv -S sshd'.  Otherwise, it  
  142. *** Info: will start automatically after the next reboot.  
  143.   
  144. *** Warning: Host configuration exited with 1 errors or warnings!  
  145. *** Warning: Make sure that all problems reported are fixed,  
  146. *** Warning: then re-run ssh-host-config.  
  147.   
  148. Administrator@LYX ~  
  149. $ ssh localhost  
  150. The authenticity of host 'localhost (::1)' can't be established.  
  151. ECDSA key fingerprint is SHA256:5/i9vvXBBfiqhzLrekd9uqPPhKz7NC+9zNwcWLn+qhk.  
  152. Are you sure you want to continue connecting (yes/no)? yes  
  153. Warning: Permanently added 'localhost' (ECDSA) to the list of known hosts.  
  154. Administrator@localhost's password:  
  155.   
  156. Administrator@LYX ~  
  157. $ who  
  158. Administrator pty1         2015-07-24 09:39 (::1)  

安装教材:

网上安装教材很多,我就不赘述了。

在windows系统中通过cygwin安装hadoop:http://my.oschina.net/u/570654/blog/112757

按照这篇安装cygwin就可以。
0 0
原创粉丝点击