咖啡猫

导航

Installing Cygwin and Starting the SSH Daemon

This chapter explains how to install Cygwin and start the SSH daemon on Microsoft Windows hosts. This chapter is applicable only when you want to install a Management Agent on a Microsoft Windows host, using the Add Host Targets Wizard or EM CLI. In particular, this chapter covers the following:

7.1 Overview

The Add Host Targets Wizard is an application built into the Enterprise Manager Cloud Control console. It offers GUI-rich, interactive screens that enable you to install Oracle Management Agents (Management Agents) on unmanaged hosts and convert them to managed hosts, so that they can be monitored and managed in Enterprise Manager Cloud Control.

When you use the Add Host Targets Wizard to install a Management Agent on a host running on Microsoft Windows, as a prerequisite, you must install Cygwin and start the SSH Daemon on the host. To do so, follow the steps listed in Section 7.3.

Cygwin is essentially a utility that offers a Linux-like environment on a Microsoft Windows host. Technically, it is a DLL (cygwin1.dll) that acts as a Linux API layer providing substantial Linux API functionality. Once you install Cygwin, you can configure the SSH Daemon on the host. The Add Host Targets Wizard is certified and supported with Cygwin 1.7.

The SSH Daemon enables the Add Host Targets Wizard to establish SSH connectivity between the OMS host and the host on which you want to install a Management Agent. Using this connectivity, the wizard transfers the Management Agent software binaries to the destination host over SSH protocol, installs the Management Agent, and configures it.

7.2 Before You Begin

Before starting with the SSHD setup, ensure you are not using OpenSSH and MKSNT when using the Add Host Targets Wizard. To do so, perform the following checks:

  1. Ensure OpenSSH\bin and mksnt are not in your PATH environment variable. If they are, remove them by doing the following:

    1. Right-click on My Computer and go to Properties.

    2. In the System Properties window, click Advanced.

    3. In this tab, click Environment Variables.

    4. Here, search for the PATH system variable, select it, and if the OpenSSH\bin and mksnt are present in PATH, click Edit.

    5. In the Edit System Variable dialog box, delete these two values from PATH,then click OK.

    Surrounding text describes cygwin_1.JPG.
  2. Stop the SSH Daemon if it is running from OpenSSHMKS or any other vendor. If the SSH Daemon is running, stop it by doing the following:

    1. Right-click on My Computer, and select Manage.

    2. In the Computer Management window, in the left pane, expand Services and Applications, and select Services.

    3. In the right pane, click the SSH Daemon/MKS Secure Shell service, then click the Stop button.

    Surrounding text describes cygwin_2.JPG.

Note:

The navigational steps described in this section may vary for different Microsoft Windows operating systems.

7.3 Installing Cygwin

To install Cygwin on a Microsoft Windows host, follow these steps:

  1. Access the following URL, then click Install Cygwin:

    http://www.cygwin.com/

  2. Download the 32-bit version (if you are running a 32-bit version of Microsoft Windows) or the 64-bit version (if you are running a 64-bit version of Microsoft Windows) of the Cygwin setup executable.

  3. Run the setup executable, then click Next to proceed.

    Surrounding text describes cygwin1.gif.
  4. On the Choose Installation Type screen, select Install from Internet, then click Next.

    Surrounding text describes cygwin2.gif.
  5. On the Choose Installation Directory screen, enter C:\cygwin as the Root Directory, then click Next.

    Note:

    If you choose to install Cygwin in a different directory, then ensure that you update the SSH_PATH, SCP_PATH, MKDIR_PATH, SH_PATH, CHMOD_PATH, and TRUE properties present in the $<OMS_HOME>/oui/prov/resources/ssPaths_msplats.properties file to their proper Cygwin binary values, after installing the Enterprise Manager system.

    For example, if you choose to install Cygwin in the D:/software/cygwin directory, then update the specified properties in the following manner:

    SCP_PATH=D:/software/cygwin/bin/scp.exe
    SH_PATH=D:/software/cygwin/bin/sh.exe
    CHMOD_PATH=D:/software/cygwin/bin/chmod.exe
    LS_PATH=D:/software/cygwin/bin/ls.exe
    
    Surrounding text describes cygwin3.gif.
  6. On the Select Local Package Directory screen, select a directory on your local machine where you want to store the downloaded installation files, then click Next.

    Surrounding text describes cygwin_3.JPG.
  7. On the Select Connection Type screen, select appropriate settings to connect to the internet, then click Next.

    Surrounding text describes cygwin5.gif.
  8. On the Choose Download Site(s) screen, select any site from the available list, then click Next.

    Surrounding text describes cygwin6.gif.
  9. On the select packages screen, ensure that you select the following packages, then click Next:

    From the Archive category, select unzip and zip as follows:

    Surrounding text describes cygwin_4.jpg.

    From the Net category, select openssh and openssl as follows:

    Surrounding text describes cygwin_5.jpg.

    After selecting the packages and clicking Next, the Resolving Dependencies screen is displayed. Click Next to proceed.

    Surrounding text describes cygwin_6.JPG.
  10. On the Installation Status and Create Icons screen, do not make any changes. Click Finish to complete the installation process.

    Surrounding text describes cygwin10.gif.

7.4 Configuring SSH After Installing Cygwin

This section describes how to configure SSH and test your Cygwin setup after installing Cygwin on a host.

Note:

While configuring SSH, you may need to run the cygwin.bat script. While running cygwin.bat in Microsoft Windows Server 2008 and Microsoft Windows Vista, ensure that you invoke it in administrator mode. To do this, right-click the cygwin.bat file and select Run as administrator.

To configure SSH and test your Cygwin setup, follow these steps:

  1. After you install Cygwin, navigate to the C:\cygwin directory, open the Cygwin.bat file in edit mode using any editor, and add the following line before invoking the bash shell.

    set CYGWIN=binmode ntsec

    For example, here are the contents for the Cygwin.bat file after adding the above line:

    @echo off
    
    C:
    chdir C:\cygwin\bin
    set CYGWIN=binmode ntsec
    bash --login -i
    
  2. To verify if Cygwin (cygrunsrv) is installed properly, run C:\cygwin\Cygwin.bat, and execute the following command:

    cygrunsrv -h
    

    If Cygwin is installed properly, then all the Cygwin help options are displayed on the screen. However, if this command returns an error message, then you may have to reinstall Cygwin.

  3. To install the SSHD service, run C:\cygwin\Cygwin.bat, and execute the following command:

    ssh-host-config
    

    After running the command, you are prompted the following questions:

    *** Query: Should privilege separation be used? <yes/no>: yes
    *** Query: New local account 'sshd'? <yes/no>: yes
    *** Query: Do you 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 deamon: [] binmode ntsec
    *** Query: Do you want to use a different name? (yes/no) yes/no
    

    At this point, if you want to use the same name, that is cyg_server, enter no. You are then prompted the following questions:

    *** Query: Create new privileged user account 'cyg_server'? (yes/no) yes
    *** Query: Please enter the password:
    *** Query: Renter:
    

    However, if you want to use a different name, enter yes. You are then prompted the following questions:

    *** Query: Enter the new user name: cyg_server1
    *** Query: Reenter: cyg_server1
    *** Query: Create new privileged user account 'cyg_server1'? (yes/no) yes
    *** Query: Please enter the password:
    *** Query: Reenter:
    

    If the configuration is successful, you will see the following message:

    Host configuration finished. Have fun!
    
  4. Backup the c:\cygwin\etc\passwd file and then use any editor to open the file in edit mode. Remove only those entries of the user that you will use to connect to the host on which you want to install a Management Agent. Ask the user to make a backup of the c:\cygwin\etc\passwd file before editing.

    • If the user that you are employing to connect to the host on which you want to install the Management Agent is a local user, runC:\cygwin\Cygwin.bat and execute the following:

      /bin/mkpasswd -l –u <USER> >> /etc/passwd (for example, /bin/mkpasswd -l -u pjohn >> /etc/passwd)
      
    • If the user you are employing to connect to the host on which you want to install the Management Agent running is a domain user, runC:\cygwin\Cygwin.bat and execute the following:

      /bin/mkpasswd -d -u <USER> >> /etc/passwd (for example, /bin/mkpasswd -d -u pjohn >> /etc/passwd)
      mkdir -p /home/<USER>  (for example, mkdir -p /home/pjohn)
      chown <USER> /home/<USER> (for example, chown pjohn /home/pjohn)
      
  5. (domain user only) If the user you are employing to connect to the host on which you want to install the Management Agent is a domain user, do the following to start the SSH daemon:

    1. Right-click on My Computer, and select Manage.

    2. In the Computer Management dialog box that appears, go to Services and Applications, and select CYGWIN sshd.

    3. Right-click CYGWIN sshd and select Properties.

    4. In the Properties dialog box, go to the Log On tab.

    5. Here, specify the domain/user name and password. Click Apply.

    6. Run C:\cygwin\Cygwin.bat, and execute the following:

      chown <USERNAME> /var/log/sshd.log
      chown -R <USERNAME> /var/empty
      chown <USERNAME> /etc/ssh*
      chmod 755 /var/empty
      chmod 644 /var/log/sshd.log
      

      Note:

      If /var/log/sshd.log does not exist, you do not have to execute the following commands:
      chown <USERNAME> /var/log/sshd.log
      chmod 644 /var/log/sshd.log
      
  6. Perform one of the following steps to start the SSH daemon:

    Run C:/cygwin/Cygwin.bat and execute the following command:

    /usr/sbin/sshd

    OR

    Run C:/cygwin/Cygwin.bat and execute the following command:

    cygrunsrv -S sshd

    OR

    Perform these steps:

    1. Right-click on My Computer, and select Manage.

    2. In the Computer Management dialog box that appears, go to Services and Applications, and select CYGWIN sshd.

    3. Click CYGWIN sshd, then click the Start button.

    Surrounding text describes cygwin_start_service.jpg.

    Note:

    If the SSH daemon does not start up, view the c:\cygwin\var\log\sshd.log file for information on why the start up failed.
  7. You can now test your Cygwin setup.

    To do this, go to a different machine (that has the ssh client running), and execute the following command:

    ssh -l <USERNAME> <localhost> 'date'
    
    OR
    
    ssh -l <USERNAME> <this node> 'date'
    

    For example,

    ssh -l pjohn example.com 'date'
    

    This command will prompt you to specify the password. When you specify the correct password, the command should return the accurate date.

Note:

If you experience a process fork failure, memory leak error, or a file access error after configuring SSH, view the following website for a workaround:

http://cygwin.com/faq.html 

If you are unable to find a workaround for your problem, report your problem to the Cygwin community using the following website:

http://cygwin.com/problems.html

 

原文引自:http://docs.oracle.com/cd/E24628_01/install.121/e22624/preinstall_req_cygwin_ssh.htm#CBHIAFGI

posted on 2014-03-06 21:14  咖啡猫1292  阅读(518)  评论(0编辑  收藏  举报