This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Win2003 server and cron/sshd as services (1.5.19)


Hi Mark,

Thanks for looking at this with me. I have restarted the sshd service many times, and have provided the password for the sshd_server account each time I've installed the service (whether installing it manually or with ssh-host-config). Below is how I have been typically installing the service, when doing it manually. It appears to be functionally equivalent to your script.

It's strange how the service starts normally, and sshd enters the process table, but it appears to refuse to run. I wonder if there is a way to test my password for the sshd_server account (or would cygrunsrv complain if it were wrong?)

 Thanks
 Mike Dunn

mdunn@h-dlt ~
$ cygrunsrv -Q sshd
Service             : sshd
Display name        : CYGWIN sshd
Current State       : Running
Controls Accepted   : Stop
Command             : /usr/sbin/sshd -D

mdunn@h-dlt ~
$ cygrunsrv -E sshd

mdunn@h-dlt ~
$ cygrunsrv -R sshd

mdunn@h-dlt ~
$ cygrunsrv -I sshd --shutdown -p /usr/sbin/sshd -a "-D -ddd" \
> -d "CYGWIN sshd" -u sshd_server -w a_fine_password -e "CYGWIN=binmode ntsec tty"


mdunn@h-dlt ~
$ cygrunsrv -S sshd

mdunn@h-dlt ~
$ ls -l /var/log/sshd.log
-rw-r--r-- 1 sshd_server None 0 May  2 12:13 /var/log/sshd.log

mdunn@h-dlt ~
$ date
Tue May  2 17:38:35 CDT 2006

mdunn@h-dlt ~
$ netstat -an | grep -i LIST
 TCP    0.0.0.0:135            0.0.0.0:0              LISTENING
 TCP    0.0.0.0:445            0.0.0.0:0              LISTENING
 TCP    0.0.0.0:1025           0.0.0.0:0              LISTENING
 TCP    0.0.0.0:2967           0.0.0.0:0              LISTENING
 TCP    0.0.0.0:3389           0.0.0.0:0              LISTENING
 TCP    0.0.0.0:6389           0.0.0.0:0              LISTENING
 TCP    0.0.0.0:10000          0.0.0.0:0              LISTENING
 TCP    0.0.0.0:13701          0.0.0.0:0              LISTENING
 TCP    0.0.0.0:13711          0.0.0.0:0              LISTENING
 TCP    0.0.0.0:13720          0.0.0.0:0              LISTENING
 TCP    0.0.0.0:13721          0.0.0.0:0              LISTENING
 TCP    0.0.0.0:13722          0.0.0.0:0              LISTENING
 TCP    0.0.0.0:13723          0.0.0.0:0              LISTENING
 TCP    0.0.0.0:13724          0.0.0.0:0              LISTENING
 TCP    0.0.0.0:13782          0.0.0.0:0              LISTENING
 TCP    0.0.0.0:13783          0.0.0.0:0              LISTENING
 TCP    0.0.0.0:34571          0.0.0.0:0              LISTENING
 TCP    0.0.0.0:34572          0.0.0.0:0              LISTENING
 TCP    127.0.0.1:1047         0.0.0.0:0              LISTENING
 TCP    127.0.0.1:1052         0.0.0.0:0              LISTENING
 TCP    127.0.0.1:1057         0.0.0.0:0              LISTENING
 TCP    127.0.0.1:1060         0.0.0.0:0              LISTENING
 TCP    127.0.0.1:1072         0.0.0.0:0              LISTENING
 TCP    127.0.0.1:1131         0.0.0.0:0              LISTENING
 TCP    172.16.20.27:139       0.0.0.0:0              LISTENING
 TCP    172.16.90.89:139       0.0.0.0:0              LISTENING

mdunn@h-dlt ~
$ telnet localhost 22
Trying 127.0.0.1...
telnet: Unable to connect to remote host: Connection refused

mdunn@h-dlt ~
$





Harig, Mark wrote:
I've been having problems getting cron/sshd to work properly (as
services or not as services) on a Win 2003 server. I understand that
certain attributes of the SYSTEM account changed in win2003, and I've tried to allow ssh-host-config to setup sshd, but with no success. I
have tried setting up both sshd and cron manually (following relevant win2003 advice from
http://www.cygwin.com/ml/cygwin/2003-11/msg00368.html), but I still
cannot seem to get either service to work properly.

Have you stopped and started the ssh service several times? If so, have you remembered to provide the password that that 'ssh-host-config' requires you to create? It would be helpful in diagnosing your problem if you were to provide the text of your commands for starting and stopping the ssh service.

Here is an edited copy of the command that I have put into a wrapper
script to start the ssh service.  I am running sshd on several computers
running W2003.  I have edited out the password that I use.  See the
cygrunsrv documentation for a description of its options.

start_sshd.sh
------------

#!/bin/bash

# Stop if any errors occur.
set -o errexit;

# If there is a running service, then stop it and remove it.
cygrunsrv --query sshd > /dev/null 2>&1 && {
        cygrunsrv --stop $service;
        cygrunsrv --remove $service;
};

# Install the sshd service.
cygrunsrv --install sshd --shutdown --path /usr/sbin/sshd --args "-D" \
    --disp "Cygwin sshd" --desc "Cygwin Openssh service" \
    --user sshd_server --passwd "your_fine_password" \
    --env "CYGWIN=binmode ntsec tty";

# Start the sshd service.
cygrunsrv --start sshd;

# === End of start_sshd.sh === #


Of course, since 'your_fine_password' is provided in clear text, you'll want to keep this script protected, or maybe change the script to prompt you for the password.


-- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/



--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]