Cygwin: Difference between revisions

From miki
Jump to navigation Jump to search
(Adding users)
Line 14: Line 14:
$ net user <username> <password> /add /yes
$ net user <username> <password> /add /yes
$ net localgroup <an_local_group> <username> /add
$ net localgroup <an_local_group> <username> /add
$ mkpassd -l -u <username> >> /etc/passwd
$ mkpasswd -l -u <username> >> /etc/passwd
</source>

== Installing a Service ==

''Reference: Cygwin inetutils-1.5 OLD-README''

=== Windows NT4, Windows 2000, Windows XP ===

Under Windows NT inetd must be started from service manager. To accompish that, you can install inetd as service running under '''cygrunsrv''':
<source lang=bash>
cygrunsrv -I inetd -d "CYGWIN inetd" -p /usr/sbin/inetd -a -D
</source>

This way, inetd is running as the SYSTEM (LocalSystem) user who has all required permissions, up to Windows XP.

There's also another way to install inetd as service. It allows to run inetd without '''cygrunsrv''':

<source lang=bash>
inetd --install-as-service
inetd --remove-as-service
</source>

However, this always installs inetd as service running under the SYSTEM account, with the problems mentioned below starting with Windows 2003. This also adds the problem that you have to change the system environment so that The Cygwin '''/bin''' directory is in <tt>%Path%</tt>. For that reason it's much better to use cygrunsrv to start inetd.

=== Windows 2003, Windows Vista ===

However, beginning with Windows 2003 Server and Windows Vista, the SYSTEM user is lacking the ''"Create a token object"'' right, which is required to change the user without providing the password.

On these systems you have to create an admin user account with special additional user rights. You can use the Cygwin tool '''editrights''' or the local/domain security policy '''mmc''' snap in to set these rights:

''Create a token object''
''Act as part of the operating system''
''Replace process level token''
''Increase quotas''
''Logon as a service''

=== Start/Stop the service ===

After you have installed inetd it will be started automatically on reboot. Manually starting and stopping is possible via

<source lang=winbatch>
net start inetd
net stop inetd
</source>
</source>

Revision as of 15:08, 14 October 2008

Troubleshooting Cygwin

  • Look for multiple copies of the cygwin DLL cygwin1.dll. Removes all copies that are not in the cygwin install directory (usually c:\cygwin).
  • List of interfering software:
    • NoMachine NX Client - installs a custom version of the Cygwin DLL which can cause multiple interferences:
      • Cygwin crashes when multiple instances are launched.
      • Running cygwin commands (like ls) in a NT command shell when another instance of cygwin is running creates application error (Memory cannot be "read").
      • setup.exe fails because it runs several instances of bash.
    • SysInternals' Process Monitor
      • All back-quoted commands or $() commands in scripts fail until Windows is restarted

Adding Users

Create the user in Windows User Management first, then use command mkpasswd to add it to Cygwin environment.

$ net user <username> <password> /add /yes
$ net localgroup <an_local_group> <username> /add
$ mkpasswd -l -u <username> >> /etc/passwd

Installing a Service

Reference: Cygwin inetutils-1.5 OLD-README

Windows NT4, Windows 2000, Windows XP

Under Windows NT inetd must be started from service manager. To accompish that, you can install inetd as service running under cygrunsrv:

cygrunsrv -I inetd -d "CYGWIN inetd" -p /usr/sbin/inetd -a -D

This way, inetd is running as the SYSTEM (LocalSystem) user who has all required permissions, up to Windows XP.

There's also another way to install inetd as service. It allows to run inetd without cygrunsrv:

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

However, this always installs inetd as service running under the SYSTEM account, with the problems mentioned below starting with Windows 2003. This also adds the problem that you have to change the system environment so that The Cygwin /bin directory is in %Path%. For that reason it's much better to use cygrunsrv to start inetd.

Windows 2003, Windows Vista

However, beginning with Windows 2003 Server and Windows Vista, the SYSTEM user is lacking the "Create a token object" right, which is required to change the user without providing the password.

On these systems you have to create an admin user account with special additional user rights. You can use the Cygwin tool editrights or the local/domain security policy mmc snap in to set these rights:

Create a token object
Act as part of the operating system
Replace process level token
Increase quotas
Logon as a service

Start/Stop the service

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