Subject: Re: telnet
From: "Gerrit P. Haase" <[email-masked]>
To: "H.Merijn Brand" <[email-masked]>
Cc: Cygwin Development <[email-masked]>
Date: Tue, 21 Jan 2003 18:35:40 +0100

H.Merijn schrieb:

> On Mon 20 Jan 2003 11:14, "Gerrit P. Haase" <[email-masked]> wrote:
>> H.Merijn schrieb:
>> 
>> > Given that cygwin is installed on a Win2k/sp3 target, is there an easy way to
>> > enable telnet from another machine?
>> 
>> Use inetd, this is in the package inetutils.
>> It is installed via cygrunsrv as service.

> There might be a Cygwin bug here. If I do:

> # cygrunsrv -I inetd -p C:/cygwin/usr/sbin/inetd.exe -o

> I indeed see a new service, but the service is

>         Display name:       inetd
>         Description:
>         Path to executable: C:\Cygwin\bin\cygrunsrv.exe
>         Startup type:       Automatic

I'm sorry, was my fault to give you some wrong advice. There are two
ways of running a service.  Usual cygrunsrv is used, then it is correct
that as executable is shown cygrunsrv, there are also some parameters
then which tell cygrunsrv which executable to start as service.

In case of inetd, there is a built in setup routine, called with
inetd --install-as-service
but first see the paste from the README below, please.

> If I then use regedit to change it to

>         Display name:       inetd
>         Description:
>         Path to executable: C:\Cygwin\usr\sbin\inetd.exe
>         Startup type:       Automatic

See above & below, please.

All is in the README :-)
/usr/doc/Cygwin/inetutils-x.x.x.README

...

The important features in brief
================================

- Before starting any program, be aware that all neccessary configuration
  files in /etc have to be generated first! Call

        iu-config

  once after you installed the inetutils the first time. That
  generates some files:

        /etc/inetd.conf  -  inetd configuration. See man pages.
        /etc/shells      -  Allowed login shells.
        /etc/ftpusers    -  List of users not allowed to login.
                            Set to "ftp" and "anonymous" by default.
        /etc/ftpwelcome  -  Message printed to welcome a user at the
                            ftp server before login.
        /etc/motd        -  "message of today", printed by ftp after
                            successful login. Also printed by `login(1)'
                            after successful login.

- To start interactive telnet/rsh/rlogin sessions you need /bin/login.exe
  which is a separate package (part of the Cygwin standard net distro).

- inetd:

  Under W9X inetd can be started from a shell prompt or from the
  autostart folder.

  Under NT/W2K inetd must be started from service manager. It
  must not be started via SRVANY but it has two new options
  to install or remove it as service:

        inetd --install-as-service
        inetd --remove-as-service

  When you already have an older version of inetd installed,
  please remove the service before installing the new one.
  
  After you have installed inetd it will be started automatically
  on reboot. Manually starting and stopping is possible via

        net start inetd
        net stop inetd

  Current caveat: inetd is visible twice in the process list.
  This is currently needed to work correctly with the service
  manager. This should be solved in a future release.

  If you don't start inetd as service under LocalSystem but under
  another account, you have to care that that account has several
  user rights set in the user manager resp. local/domain security
  policy mmc snap in:
        "Act as part of the operating system"
        "Replace process level token"
        "Increase quotas"
        "Logon as a service"
  Note that administrators do not have all that user rights set
  by default!

  For all application started via NT/W2K service manager under 
  LocalSystem account, the following restrictions apply:

  - The environment variable CYGWIN must be either set in the system
    environment to be active from start on or you can set CYGWIN thru
    the registry:
    Under the key HKLM\Software\Cygnus Solutions\Cygwin\Program Options
    create a REG_SZ (String) named like the full DOS path to the application,
    eg. "C:\usr\bin\inetd.exe" and with the value equal to the preferred
    CYGWIN settings, eg "binmode tty ntsec".

  - The system environment variable PATH must contain the path
    to the directory which contains the cygwin1.dll.

  - No user mount point is valid anymore! You have to install all
    your mount points in the system mount table. This doesn't
    change after you have logged in to a normal user account eg.
    via telnet/rlogin. It's possible that we can use the user
    mounts as soon as somebody contributes a patch to login and
    ftp that allows loading a user hive into the registry after
    authentication.

- ftpd:

  Under NT/W2K ftpd is now able to change user context with the
  help of NT security. This is useful mostly when using all features
  of the ntsec option of cygwin. The 'S-' and 'U-' fields in
  pw_gecos are taken into account as it's described in
  the 'login.README' file.

  Anonymous ftp is usable by creating a `ftp' user in /etc/passwd
  and either create a `ftp' user in the NT user database or by using
  the aforementioned `S-' and `U-' entries in /etc/passwd together
  with ntsec ON. If, for example, the cygwin user `ftp' should be
  attached to the NT user `guest', you can create the ftp user
  from your guest entry:

  ftp::100:10:U-guest,S-1-5-21-XXX-YYY-ZZZ-501:/home/ftp:/bin/false

  Note that:
  - The `ftp' entry needs a valid directory.
  - The attached NT user must not have a password.

  On 9X systems /etc/passwd is checked for DES encrypted passwords
  as provided by the crypt package.

- ftp:

  ftp reports to be a UNIX system, so binary mode is ON by default
  with most servers.

- On 95/98 systems you need to install the login package and the
  crypt package.

...

> I get an error that the service cannot find cygwin1.dll
> When I copy it to /usr/sbin, all works (though I find multiple warnings in the
> system application log)

The path to cygwin1.dll needs to be in the Windows PATH.

> C:\Cygwin\bin is in the system environment's PATH (not in the user's
> environment, so all users get it)

Then I'm not sure why this error happens.  Should be gone if the service
is installed correct under System account.

Gerrit
-- 
=^..^=

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/