http://blog.csdn.net/cybercode/article/details/7080743
This article is intended for me to build a Hadoop environment in Win7 (64-bit). First, refer to the use summary in Cygwin this article to install the necessary packages in Cygwin, and then proceed as follows:
[Plain]View Plaincopy
- Sony@sony-vaio~ $ ssh-host-config
- Info:generating/etc/ssh_host_key
- Info:generating/etc/ssh_host_rsa_key
- Info:generating/etc/ssh_host_dsa_key
- Info:generating/etc/ssh_host_ecdsa_key
- info:creating default/etc/ssh_config File
- info:creating default/etc/sshd_config File
- Info:privilege separation is set to Yes by default since OpenSSH 3.3.
- Info:however, this requires a non-privileged account called ' sshd '.
- Info:for More info on privilege separation read/usr/share/doc/openssh/read
- Me.privsep.
- Query:should privilege separation be used? (yes/no) No
- Info:updating/etc/sshd_config file
- Query:do want to install sshd as a service?
- Query: (Say "No" if it is already installed as a service) (yes/no) Yes
- Query:enter the value of CYGWIN for the daemon:netsec] Netsec
- Info:on Windows Server 2003, Windows Vista, and above, the
- Info:system account cannot setuid to other users--a capability
- INFO:SSHD requires. You need to has or to create a privileged
- Info:account. This script would help you to do so.
- Info:you appear to be running Windows XP 64bit, Windows 2003 Server,
- Info:or later. On these systems, it's not possible to use the LocalSystem
- Info:account for services which can change the user ID without an
- Info:explicit password (such as passwordless logins [e.g. public key
- Info:authentication] via sshd).
- Info:if want to enable that functionality, it's required to create
- Info:a new account with special privileges (unless a similar account
- Info:already exists). Used to run these special
- Info:servers.
- Info:note that creating a new user requires that the current account
- Info:have Administrator privileges itself.
- Info:no privileged account could is found.
- Info:this script plans to use ' cyg_server '.
- Info: ' Cyg_server ' is only being used by registered services.
- Query:do want to use a different name? (yes/no) Yes
- Query:enter the new user Name:sony
- Query:Reenter:sony
- warning:privileged account ' Sony ' was specified,
- Warning:but It does not has the necessary privileges.
- Warning:continuing, but would probably use a different account.
- Warning:the specified account ' Sony ' does not having the
- warning:required permissions or group memberships. This May
- Warning:cause problems if not corrected; Continuing ...
- Query:please Enter the password for user ' Sony ':
- Query:reenter:
- Info:the sshd Service has been installed under the ' Sony '
- Info:account. To start the service now, call ' net start sshd ' or
- Info: ' Cygrunsrv-s sshd '. Otherwise, it'll start automatically
- Info:after the next reboot.
- Info:host configuration finished. Have fun!
$ net start sshd
A system error 1069---indicates that the service could not be started because of a logon failure
Workaround: Enter services.msc in cmd to open the Windows service and change the password in the service.
(in the process of configuring SSH above, my username is: Sony password is: 123456)
SSHD service installed successfully as follows:
[Plain]View Plaincopy
- [Email protected] ~ $ net start sshd
- CYGWIN sshd Service is starting.
- CYGWIN sshd Service has started successfully
Next is configure no password login:
[Plain]View Plaincopy
- [Email protected] ~ $ ssh-keygen-t RSA
- Generating public/private RSA key pair.
- Enter file in which to save the key (/HOME/SONY/.SSH/ID_RSA):
- Created directory '/home/sony/.ssh '.
- Enter passphrase (empty for no passphrase):
- Enter same Passphrase again:
- Your identification has been saved In/home/sony/.ssh/id_rsa.
- Your public key has been saved in/home/sony/.ssh/id_rsa.pub.
- The key fingerprint is:
- e8:38:5e:e3:bb:cf:76:03:61:5f:f2:68:ed:a3:49:db [email protected]
- The key ' s Randomart image is:
- +--[RSA 2048]----+
- | |
- | |
- | |
- | . O. . |
- | .. So * |
- | O. + O |
- | O + O.. |
- | . + O.. O+o |
- | . +=o.+oe. |
- +-----------------+
- [Email protected] ~ $ CD. ssh/
- [Email protected] ~/.SSH $ ls
- Id_rsa id_rsa.pub
- [Email protected] ~/.SSH $ CP id_rsa.pub Authorized_keys
- [Email protected] ~/.SSH $ ls
- Authorized_keys Id_rsa id_rsa.pub
Verify the following:
[Plain]View Plaincopy
- [Email protected] ~/.ssh $ ssh localhost
- The authenticity of host ' localhost ' (:: 1) ' can ' t be established.
- ECDSA key fingerprint is 5f:21:b1:24:80:92:f6:af:3e:e3:a8:f9:cb:a4:4f:ec.
- Is you sure want to continue connecting (yes/no)? Yes
- warning:permanently added ' localhost ' (ECDSA) to the list of known hosts.
- [Email protected] ~ $ who
- Sony Tty0 2011-11-25 15:42 (:: 1)
Cygwin installing the SSHD service and implementing a password-free login