Cygwin sshd installation Configuration

Source: Internet
Author: User

Cygwin sshd installation Configuration

Cygwin installation:
1. Download setup.exe from [url] www.cywin.com [/url] to install the boot program
2. Double-click setup.exe to start installation.
3. Select install source for Internet (if there is a software package downloaded from Internet last time, you can select install for local directory to select the directory to store)
4. Define the installation directory c:/cygwin (1) install for: all users (2) default text file type: Unix/binary
5. Define the directory where the downloaded software is stored (you can use the downloaded package to install it from the local hard disk next time). G:/download/cywin
6. Select the type of connection to the Internet.
7. Select an image download site
8. Select the installation package
9. cywin automatically downloads and installs the selected software package.
10. In my computer-> properties-> advanced-> environment variables, add the cygwin/bin path to the path environment variable, for example:; C:/cygwin/bin.
So far: cygwin has been installed!

 

 

The following operations must be performed under $ username!
**************************************** ***********************

Cygwin sshd installation configuration and key settings:

$ mkpasswd.exe -l > /etc/passwd
$ mkgroup.exe -l > /etc/group
$ chmod.exe +r /etc/passwd
$ chmod.exe +r /etc/group
$ chmod.exe +rwx /var

$ ssh-host-config
*** Info: Generating /etc/ssh_host_key
*** Info: Generating /etc/ssh_host_rsa_key
*** Info: Generating /etc/ssh_host_dsa_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/REAME.privsep.
*** Query: Should privilege separation be used? (yes/no) no
*** Info: Updating /etc/sshd_config file
*** Info: Creating default /etc/inetd.d/sshd-inetd file
*** Info: Updated /etc/inetd.d/sshd-inetd
*** Warning: The following functions require administrator privileges!
*** Query: Do you want to install sshd as a service?
*** Query: (Say "no" if it is already installed as a service) (yes/no) yes
*** Info: Note that the CYGWIN variable must contain at least "ntsec"
*** Info: for sshd to be able to change user context without password.
*** Query: Enter the value of CYGWIN for the daemon: [ntsec] ntsec
*** 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 have or to create a privileged
*** Info: account.  This script will help you do so.
*** Info: You appear to be running Windows 2003 Server or later.  On 2003
*** Info: and later systems, it's not possible to use the LocalSystem
*** Info: account for services that can change the user id without an
*** Info: explicit password (such as passwordless logins [e.g. public key
*** Info: authentication] via sshd).
*** Info: If you want to enable that functionality, it's required to create
*** Info: a new account with special privileges (unless a similar account
*** Info: already exists). This account is then 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 be found.
*** Info: This script plans to use 'cyg_server'.
*** Info: 'cyg_server' will only be used by registered services.
*** Query: Do you want to use a different name? (yes/no) yes
*** Query: Enter the new user name: username
*** Query: Reenter: username
*** Warning: Privileged account 'username' was specified,
*** Warning: but it does not have the necessary privileges.
*** Warning: Continuing, but will probably use a different account.
*** Warning: The specified account 'username' does not have the
*** Warning: required permissions or group memberships. This may
*** Warning: cause problems if not corrected; continuing...
*** Query: Please enter the password for user 'username': ******
*** Query: Reenter: ******
*** Info: The sshd service has been installed under the 'username'
*** Info: account.  To start the service now, call `net start sshd' or
*** Info: `cygrunsrv -S sshd'.  Otherwise, it will start automatically
*** Info: after the next reboot.
*** Info: Host configuration finished. Have fun!

$ Net start sshd
System Error 1069 occurs.
The service cannot be started due to logon failure.
-- This is caused by incorrect user password input. This problem may occur in sshd after the user is changed in the future. You can change the user settings in the logon tag in services. MSC!

$ Net start sshd
The cygwin sshd service is starting.
The cygwin sshd service has been started successfully.

 

Key settings:
$ CD/home/username/
$ Mkdir. Ssh & chmod.exe 700. SSH
$ Cd. Ssh/
$ VI authorized_keys (place the Administrator's public key in it)
$ Chmod.exe 600 authorized_keys

 

Create a key pair:
$ Ssh-keygen-T RSA
$ Press Enter!

Delete sshd service:
$ Net stop sshd
$ Cygrunsrv-r sshd

 

Terminal settings:
# Set PS1 display, Chinese display, alias
VI/etc/profile
Export PS1 = "[/u @/h/W]/$"
Export lc_all = zh_cn.gb2312
Export lc_ctype = zh_cn.gb2312
Export lang = zh_cn.gb2312
Export lesscharset = Latin1
Export lc_messages = zh_cn.euccn
Export xmodifiers = "@ im = chinput" 3
Stty cs8-istrip
Stty pass8
Alias ls = 'ls -- color -- show-control-chars -- Time-style = long-ISO'
Alias LL = 'LS-l -- color -- show-control-chars -- Time-style = long-ISO'

 

# Set the terminal input to Chinese
VI ~ /. Inputrc
Set meta-flag on
Set input-meta on
Set output-meta on
Set convert-meta off

echo "set meta-flag on" >> ~/.inputrc
echo "set input-meta on" >> ~/.inputrc
echo "set output-meta on" >> ~/.inputrc
echo "set convert-meta off" >> ~/.inputrc

# Setting direction keys available, shell highlighted
VI ~ /. Vimrc
Set nocp
Syntax on

echo "set nocp" >> ~/.vimrc
echo "syntax on" >> ~/.vimrc

* ****** Note: if any settings of the terminal do not take effect, try another terminal!
* **********: If the connect closed or refuse prompt is displayed after the SSH service is set, check the key file permissions and ensure that. SSH 700 authorized_keys 700.
* **********: If the key does not take effect after the key is set, check whether the key is set. the SSH directory is created under/home/username and the permission is set correctly.
* **********: There are any other problems that cannot be connected. We recommend that you first check the windows event log, and you may find the result here.

 

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.