Automatic putty login for the ssh service on Cygwin

Source: Internet
Author: User
I. First install CYGWIN

  1. OS change export data: path increase d:/cygwin/bin
  2. OS: CYGWIN = ntsec tty
  3. Necessary Cygwin Security kits: OpenSSH, cygrunsrv
  4. Cygwin configures OpenSSH:
    1. Ssh-host-config
    2. Shocould privilege separation be used? (Yes/no): yes
    3. Shocould this script create a local user 'sshd' on this machine? (Yes/no): yes
    4. Do you want to install sshd as service? (Yes/no): yes
    5. Default is "ntsec". CYGWIN = ntsec tty
  5. Manual Operation OpenSSH service: net start sshd
  6. Manual relationship OpenSSH service: net stop sshd
     

Ii. Automatic Login of PUTTY

Generate public/private keys first

1. log on to the server with your username, and then:
Ssh-keygen-t rsa
The generated public/private key file is ~ by default ~ /. Ssh/
Enter the. ssh directory
Mv id_rsa.pub authorized_keys // (change to the default public key file name)
Upload the id_rsa file (Private Key) to the windows Server and delete the original id_rsa file.

2. Use PUTTYGEN. EXE to convert the id_rsa file to the putty format.
Menu: Conversions/ImportKey, select the id_rsa File
Click "Save private key" to Save the new format file to the hard disk, such as D:/mykey. ppk.

Then create a putty shortcut in the following format:

Putty-I D:/mykey. ppk-l yourname server's IP

Okay ~~~
Iii. Implementation Process

Netoearth @ yjz0065 ~
$ Ssh-host-config
Overwrite existing/etc/ssh_config file? (Yes/no) yes
Generating/etc/ssh_config file
Overwrite existing/etc/sshd_config file? (Yes/no) yes
Privilege Separation is set to yes by default since OpenSSH 3.3.
However, this requires a non-privileged account called 'sshd '.
For more info on Privilege Separation read/usr/share/doc/OpenSSH/readme. privsep
.

Shocould Privilege Separation be used? (Yes/No) Yes
Generating/etc/sshd_config file

Warning: The following functions require administrator privileges!

Do you want to install sshd as service?
(Say "no" if it's already installed as Service) (Yes/No) Yes

You appear to be running Windows 2003 Server or later. On 2003 and
Later systems, it's not possible to use the LocalSystem account
If sshd shocould allow passwordless Logon (e. g. Public Key Authentication ).
If you want to enable that functionality, it's required to create a new
Account 'sshd _ Server' with special privileges, which is then used to run
The sshd service under.

Shocould this script create a new local account 'sshd _ Server' which has
The required privileges? (Yes/no) yes

Please enter a password for new user 'sshd _ Server'. Please be sure that
This password matches the password rules given on your system.
Entering no password will exit the configuration. PASSWORD = password

User 'sshd _ Server' has been created with password 'Password '.
If you change the password, please keep in mind to change the password
For the sshd service, too.

Also keep in mind that the user sshd_server needs read permissions on all
Users '. ssh/authorized_keys file to allow public key authentication
These users !. (Re-) running ssh-user-config for each user will set
Required permissions correctly.

Which value shocould the environment variable CYGWIN have when
Sshd starts? It's recommended to set at least "ntsec" to be
Able to change user context without password.
Default is "ntsec". CYGWIN = netec

The service has been installed under sshd_server account.
To start the service, call 'net start sshd' or 'cygrunsrv-S sshd '.

Host configuration finished. Have fun!

Netoearth @ yjz0065 ~
$ Net start sshd
The CYGWIN sshd service is starting.
The CYGWIN sshd service has been started successfully.

Netoearth @ yjz0065 ~
$ Ssh-keygen.exe-t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/cygdrive/d/. ssh/id_dsa ):
Enter passphrase (empty for no passphrase ):
Enter same passphrase again:
Your identification has been saved in/cygdrive/d/. ssh/id_dsa.
Your public key has been saved in/cygdrive/d/. ssh/id_dsa.pub.
The key fingerprint is:
10: f1: b0: 59: 60: 9d: ef: a7: AB: b3: 36: 8d: 01: 63: c4: 6f netoearth @ yjz0065

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.