Pages

Wednesday, August 7, 2013

cygwin sshd service is not starting

 Scenario :
            If it is a newly configured cygwin, then we need to run the exe to configure the service. please follow the below steps to configure and start the cygwin service. please follow the steps.


  1. Ensure cygwin\bin is in your PATH environment variable. If not are, add 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 cygwin\bin is not present in PATH, click Edit.
    5. In the Edit System Variable dialog box, Add the valuethen click OK.
  2. Check cyg_server user account is there in the system, else create it.
  3. start the cygwin,
  4. 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!
    1. (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
        
    2. 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.
    3. 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.

No comments:

Post a Comment