Softpanorama

May the source be with you, but remember the KISS principle ;-)
Home Switchboard Unix Administration Red Hat TCP/IP Networks Neoliberalism Toxic Managers
(slightly skeptical) Educational society promoting "Back to basics" movement against IT overcomplexity and  bastardization of classic Unix

Cygwin tutorial

News

Unixification of Windows

Recommended Links Cygwin Packages Cygwin mini Tutorial Using Apache 1.3 with Cygwin

Classic Unix tools

Unix Utilities

Cygwin/X

X Window System

XDMCP in Cygwin

VNC Teraterm Putty screen  "Can't open display" Error
Perl on Cygwin ssh VIM Filesystem Recovery Disk Backup syslog Command line mail clients Command line Net Tools
Hummingbird Exceed SFU
(version 3.5)
uwin Xming Replacing Exceed with Cygwin Conversion of files from Windows to Unix format Humor

Etc

Cygwin is a free software package that provides a Unix-like environment and software tool set in Windows environment (2000/XP/Vista).  Cygwin was started in 1995 by Steve Chamberlain, an engineer working for Cygnus (company later bought by Red Hat, which in turn was bought by IBM). The earliest mailing list references on the Web are in early 1997, by which time it appears to have been in a functional state.

Recently it became rather unstable and updates should be  performed with great caution, only after backing up the previous installed version.

For example on Feb 16, 2020 Cygwin updated Perl from 5.34 to 5.30. That letter version is not even beta. It is alpha as for example predicate -s (-s file) does not work.  Previous version 5.26.3 worked reliably. This push for Perl 5.30 greatly undermined value of Cygwin for those who use it as the Perl platform.

Cygwin is the most popular of server Unix-emulation packages available for windows. Among alternatives we can mention uwin -- free high quality implementation from AT&T which was led by David Korn (it includes ksh93). While discontinued Microsoft SFU version 3.5 was a high quality POSIX emulator for Windows too. It is still available for Windows XP. 

It runs best on Windows XP or Windows 7 with NTFS.  Currently 64 bit version is the dominant one.

Cygwin contains:

Cygwin consists of a Unix system call emulation library, cygwin1.dll, together with a set of GNU and other free software applications organized into a large number of optionally installed packages. Among these packages are  a complete X11 development toolkit, GNU emacs, TeX and LaTeX, OpenSSH (client and server), and much more.

Due to presence of emulation layer cygwin (and especially Cygwin/X) is much slower then X servers which use native Win32 API.

Cygwin is not  equivalent of a VMWare player and does not provide a means for running Linux binary executables under MS-Windows. In order to run such software using Cygwin, that software must be compiled from its sources. Cygwin provides all of the components needed to do this in most cases; most POSIX-compliant software, including X11 applications, can easily be ported to MS-Windows using Cygwin.

For 32 bit version of Cygwin Teraterm  is a reasonably good enough replacement for “cmd” and can serve as  "out of the box" terminal for Cygwin. If you follow press Alt-G in Teraterm,  you’ll get a terminal with the following advantages:

For 64-bit version of Cygwin it does not work.

Initial installation

Default installation does not include several important utilities. Among them:

 

Cygwin provides POSIX view of the Windows file system space

By default Cygwin mapped all Windows drive as /cygdrive/c, /cygdrive/d, etc.

The slash ('/') directory points to the system partition (C:) by default. In addition to selecting the slash partition, it allows mounting arbitrary Win32 paths into the POSIX file system space using mount command

mount [OPTION] [<win32path> <posixpath>]

Many people mount each drive letter under the slash partition (e.g. C:\ to /c, D:\ to /d, etc...). That is simpler that /cygdrive/c, /cygdrive/d, etc). Here is additional information about options of the mount command in Cygwin:

  -b, --binary     (default)    text files are equivalent to binary files  (newline = \n)
  -c, --change-cygdrive-prefix  change the cygdrive path prefix to <posixpath>
  -f, --force                   force mount, don't warn about missing mount   point directories
  -h, --help                    output usage information and exit
  -m, --mount-commands          write mount commands to replicate user and system mount points and cygdrive prefixes
  -o, --options X[,X...]        specify mount options
  -p, --show-cygdrive-prefix    show user and/or system cygdrive path prefix
  -s, --system     (default)    add system-wide mount point
  -t, --text                    text files get \r\n line endings
  -u, --user                    add user-only mount point
  -v, --version                 output version information and exit
  -x, --executable              treat all files under mount point as executables
  -E, --no-executable           treat all files under mount point as non-executables
  -X, --cygwin-executable       treat all files under mount point as cygwin executables

Path translations can be done by executing the cygpath utility program

Usage: cygpath (-d|-m|-u|-w|-t TYPE) [-f FILE] [OPTION]... NAME...
       cygpath [-c HANDLE] 
       cygpath [-ADHOPSW] 
       cygpath [-F ID] 
Convert Unix and Windows format paths, or output system path information

Output type options:
  -d, --dos             print DOS (short) form of NAMEs (C:\PROGRA~1\)
  -m, --mixed           like --windows, but with regular slashes (C:/WINNT)
  -M, --mode            report on mode of file (currently binmode or textmode)
  -u, --unix            (default) print Unix form of NAMEs (/cygdrive/c/winnt)
  -w, --windows         print Windows form of NAMEs (C:\WINNT)
  -t, --type TYPE       print TYPE form: 'dos', 'mixed', 'unix', or 'windows'
Path conversion options:
  -a, --absolute        output absolute path
  -l, --long-name       print Windows long form of NAMEs (with -w, -m only)
  -p, --path            NAME is a PATH list (i.e., '/bin:/usr/bin')
  -s, --short-name      print DOS (short) form of NAMEs (with -w, -m only)
System information:
  -A, --allusers        use `All Users' instead of current user for -D, -P
  -D, --desktop         output `Desktop' directory and exit
  -H, --homeroot        output `Profiles' directory (home root) and exit
  -O, --mydocs          output `My Documents' directory and exit
  -P, --smprograms      output Start Menu `Programs' directory and exit
  -S, --sysdir          output system directory and exit
  -W, --windir          output `Windows' directory and exit
  -F, --folder ID       output special folder with numeric ID and exit
Other options:
  -f, --file FILE       read FILE for input; use - to read from STDIN
  -o, --option          read options from FILE as well (for use with --file)
  -c, --close HANDLE    close HANDLE (for use in captured process)
  -i, --ignore          ignore missing argument
  -h, --help            output usage information and exit
  -v, --version         output version information and exit

The cygpath program is a utility that converts Windows native filenames to Cygwin POSIX-style pathnames and vice versa. It can be used when a Cygwin program needs to pass a file name to a native Windows program, or expects to get a file name from a native Windows program. Alternatively, cygpath can output information about the location of important system directories in either format.

Example 3.5. Example cygpath usage

#!/bin/sh
if [ "${1}" = "" ];
	then
		XPATH=".";
	else
		XPATH="$(cygpath -w "${1}")";
fi
explorer $XPATH &

The capital options -D, -H, -P, -S, and -W output directories used by Windows that are not the same on all systems, for example -S might output C:\WINNT\SYSTEM32 or C:\WINDOWS\SYSTEM. The -H shows the Windows profiles directory that can be used as root of home. The -A option forces use of the "All Users" directories instead of the current user for the -D, -O and -P options. The -F outputs other special folders specified by their internal numeric code (decimal or 0xhex). For valid codes and symbolic names, see the CSIDL_* definitions in the include file /usr/include/w32api/shlobj.h from package w32api. The current valid range of codes for folders is 0 (Desktop) to 59 (CDBurn area). On Win9x systems with only a single user, -A has no effect; -D and -AD would have the same output. By default the output is in UNIX (POSIX) format; use the -w or -d options to get other formats.

Win32 file systems are case preserving but case insensitive. Cygwin does not currently support case distinction because, in practice, few UNIX programs actually rely on it.

Symbolic links are emulated by files containing a magic cookie followed by the path to which the link points. They are marked with the System attribute so that only files with that attribute have to be read to determine whether or not the file is a symbolic link. Hard links are fully supported under Windows NT on NTFS file systems.

The inode number for a file is calculated by hashing its full Win32 path. The inode number generated by the stat call always matches the one returned in d_ino of the dirent structure. It is worth noting that the number produced by this method is not guaranteed to be unique. However, we have not found this to be a significant problem because of the low probability of generating a duplicate inode number.

Cygwin provides the following functionality for WIN32 applications:
Process control and management: 
While processes can be created using the fork(2) function. With the exec family of functions, an existing process can be overlaid with another process. Each process has a unique process id and each process belongs to a process group.
File descriptor semantics:
Open files, pipes, sockets, fifos, and character and block special devices files have file descriptors associated with them. They can be duped and inherited with UNIX semantics.
UNIX signal semantics:
Nearly all of the UNIX signals are provided, including job control signals so that  shell can stop and restart jobs. A process can catch, block or ignore signals. Signals can be sent to processes or to process groups.
Support for devices:
Cygwin provides character and block devices with major and minor numbers as found on UNIX systems.
Terminal interface for consoles, sockets, and serial lines:
The POSIX termios interface is supported for consoles with vt100 emulation. Serial lines, and sockets that have been designated as virtual terminals. Cygwin supports pseudo-ttys.
Use of the mouse with console windows:
The left mouse button in a console window can be used to select text and copy to the clipboard. The right button (or middle button on a three button mouse) can be used to paste text from the clipboard.
Pathname mapping from UNIX to Windows:
 
UNIX naming conventions:
The PATH  variable is a : separated list of directories rather than a ; separated list. The cc  command generates files with a .o suffix by default. However, some characters such as \, *, ?, |, &, <. >, and : are not valid as part of file names. By default, directories are mounted without case distinction. However, the mount  command allows directories to be mounted as case sensitive so that the files makefile  and Makefile  are distinct. In addition, there is a registry key that can be set to make the default case sensitive.
Mapping to and from UNIX ids/permissions to NT/2000/XP permissions:
Windows NT/2000/XP subject identifiers are mapped to UNIX user ids and group ids. UNIX permissions are mapped onto Windows NT/2000/XP file ACLs. The Administrator can use chown()  to change the owner and or group of a file.
File control locking:
UNIX file control advisory locking is supported by Cygwin with deadlock detection.
System V IPC:
The System V semaphore and message calls are implemented.
Runtime linking of dynamically linked libraries:
The dlopen(), dlsym()  interface from System V Release 4 is provided.
Error mapping from Windows to UNIX:
Errors returned by WIN32 functions are mapped into UNIX errors.
i-node numbers:
An i-node number is returned when reading a file and when stating a file.
Hard links:
Hard links are supported on NTFS  file system.
Symbolic links:
Symbolic links to files and directories can be created in Cygwin and are implemented as Windows shortcuts. A .lnk  suffix will be appended to these file names but will not appear when reading directories with Cygwin. Shortcuts created by Windows appear as symbolic links in Cygwin but do not have the .lnk  suffix removed.
Fifo's:
Fifo's (UNIX named pipes) can be created with mkfifo()  and opened as an ordinary file.
Setuid and setgid programs:
Users can authorize setuid and/or setgid programs to be run on their behalf and use chmod()  to turn on setuid permission for a program. The program must be on an NTFS file system.
inet  Daemons and commands:
Cygwin comes with the inet daemon, the telnet daemon, the rlogin daemon, rsh and ssh daemons. It also includes the telnet, ftp, rsh, and rlogin  programs.
ssh and ssh daemon:
A compilation of openssh-3.6p1.

Set of utilities

Cygwin provides full set of Posix utilities (or more correctly GNU toolset).

Alphabetical list

A B C D E F G H I J K L M
N O P R S Q T U V W X Y Z

A

B

C

D

E

F

G

H

I

J

K

L

M

N

P

R

S

T

U

V

W

X

Y

Z

IMHO there are three Unix tools that can spell the difference between really good programmer or sysadmin and just above average one (even if the latter has solid knowledge of shell and Perl, knowledge of shell and Perl is necessary but not sufficient):

This two tools can also be used as a fine text in interviews on advanced Unix-related positions if you have several similar candidates. Other things equal, their knowledge definitely demonstrate the level of Unix culture superior to the average "command line junkies" level ;-)

Overview of books about GNU/open source tools can be found in Unix tools bibliography. There not that much good books on the subject, still even average books can provide you with insight in usage of the tool that you might never get via daily practice. Please note that Unix is a pretty complex system and some aspects of it are non-obvious even for those who have more than ten years of experience.


Top Visited
Switchboard
Latest
Past week
Past month

NEWS CONTENTS

Old News ;-)

[Jul 22, 2012] Igor Pechtchanski - Re Mount Windows registry into filesystem

On Mon, 7 Jul 2003, Brian Dessent wrote:

> Corinna Vinschen wrote:
> >
> > On Mon, Jul 07, 2003 at 09:19:57AM +0100, William S Fulton wrote:
> > > Is it possible to mount the registry into the filesystem?
> >
> > It is already. Try `ls -l /proc/registry'
>
> Neat. Is there any way to tell the type of the key's value using this
> interface? For example if I wanted to modify a key's value through
> "echo foo > /prog/registry/.../Key", how do I tell Cygwin that I want
> the type to be REG_EXPAND_SZ, REG_DWORD, REG_MULTI_SZ, REG_SZ, etc?

You don't. /proc/registry is read-only. If you want to modify the
registry, use regtool.

> Conversely is there a way to determine the type when reading? It
> appears that Cygwin does what you expect (e.g. returning a \0 delimited
> list for REG_MULTI_SZ) but is there any way to ask it directly?

Not that I know of. Look at fhandler_registry.cc for implementation
details.

> This is yet another really cool Cygwin feature that I had no idea about
> until now... :-)
> Brian

It pays to read the release notes... ;-)

Igor

[Jul 17, 2012] New packages in Cygwin

[Feb 09, 2011] Customizing bash

To set up bash so that cut and paste work properly, click on the "Properties" button of the window, then on the "Misc" tab. Make sure that "QuickEdit mode" and "Insert mode" are checked. These settings will be remembered next time you run bash from that shortcut. Similarly you can set the working directory inside the "Program" tab. The entry "%HOME%" is valid, but requires that you set HOME in the Windows environment.

Your home directory should contain three initialization files that control the behavior of bash. They are .profile, .bashrc and .inputrc. The Cygwin base installation creates stub files when you start bash for the first time.

.profile (other names are also valid, see the bash man page) contains bash commands. It is executed when bash is started as login shell, e.g. from the command bash --login. This is a useful place to define and export environment variables and bash functions that will be used by bash and the programs invoked by bash. It is a good place to redefine PATH if needed. We recommend adding a ":." to the end of PATH to also search the current working directory (contrary to DOS, the local directory is not searched by default). Also to avoid delays you should either unset MAILCHECK or define MAILPATH to point to your existing mail inbox.

.bashrc is similar to .profile but is executed each time an interactive bash shell is launched. It serves to define elements that are not inherited through the environment, such as aliases. If you do not use login shells, you may want to put the contents of .profile as discussed above in this file instead.

shopt -s nocaseglob

will allow bash to glob filenames in a case-insensitive manner. Note that .bashrc is not called automatically for login shells. You can source it from .profile.

.inputrc controls how programs using the readline library (including bash) behave. It is loaded automatically. For full details see the Function and Variable Index section of the GNU readline manual. Consider the following settings:

# Ignore case while completing
set completion-ignore-case on
# Make Bash 8bit clean
set meta-flag on
set convert-meta off
set output-meta on

The first command makes filename completion case insensitive, which can be convenient in a Windows environment. The next three commands allow bash to display 8-bit characters, useful for languages with accented characters. Note that tools that do not use readline for display, such as less and ls, require additional settings, which could be put in your .bashrc:

alias less='/bin/less -r'
alias ls='/bin/ls -F --color=tty --show-control-chars'

[Jul 19, 2010] Gow 0.3.0

Gow is a lightweight alternative to Cygwin. It uses a convenient Windows installer that installs about 130 extremely useful Unix applications compiled as native Win32 binaries. It is designed to be as...

[Apr 21, 2010] Cygwin Package List

Some interesting utilities

Installing Cygwin

March 13, 2005 | users.soe.ucsc.edu/~you

[Oct 11, 2009] Hints for Setting up Cygwin by Charles Plager

May 2, 2007 | www-cdf.fnal.gov

Mrxvt

rxvt is an xterm-like terminal program. mrxvt is built from the same code base, but adds tabs (similar to konsole terminals in KDE). It turns out building these for Cygwin (assuming you have the X11 libraries installed) is very easy.

  1. Visit the mrxvt home page
  2. Read the README file.
  3. Download the source.
  4. Untar the source file
    cygwin> tar xzf mrxvt_0.40.tar.gz
  5. Configure as shown in the readme file
    cygwin> ./configure --enable-everything --disable-debug
  6. Make and install
    cygwin> make && make install
Note: I recommend building mrxvt from source, but for those who want to try a built version, you can grab mine. I also have a perl script, mrxvt_options.pl, that lets you change the names of tabs, etc. mrxvt.bat (assuming you put mrxvt.exe in c:\cygwin\bin) will start it up for you.

You should be good to go. Here are the entries I have in my ~/.Xdefaults file:

!##############
!#  mrxvt
!##############
mrxvt*font:                  6x13
mrxvt*foreground:            white
mrxvt*background:            black
mrxvt*scrollbarStyle:        rxvt
! These keys are used by emacs, disable them
mrxvt*hotkey*Dummy:          Ctrl+Shift+underscore
mrxvt*hotkey*Dummy:          Ctrl+Shift+plus
Installing Perl Tk

Note: As of December 2005, you can download Tk from any Cygwin mirror using the cygwin installer. I recommend trying this first before building your own.

Perl Tk is a useful GUI addition to the Perl language. In my Useful files tar ball, you will find a few scripts that take advantage of this package. It is, however, by no means necessary, so feel free not to install it (or install it later). Note: I have always installed Perl Tk 8.00.024. There are newer versions; I just haven't tried them. If you're curious, please try and let me know how it goes. If you want to be lazy and play it safe, follow the directions below. I'm assuming that you have a full cygwin installation as shown above.

You should now be good to go. Console GUI The console GUI is a Perl Tk script that I wrote that makes it easy to log into many different machines. You can find it in the tgz above.

[Oct 11, 2009] Zenovation's Blog " How to Run a Cygwin Command From Windows Scheduler (Scheduled Tasks)

It's enough to run bash --rcfile /.bashrc name_of_the_script
June 3, 2009 | zenovations.com

After repeated problems setting up crond to run in cygwin (it just doesn't like the user accounts, no matter how enthusiastically I argue that I'm me), I spent some time figuring out how to run a Cygwin command as a scheduled task from Windows scheduler. Here is what I figured out.

Based on this mail archive post, I created the following cygrun.bat file:

?[Copy to clipboard]View Code BASH
    @echo off
    rem set HOME=c:\
    if "%DEF_PATH%"=="" set DEF_PATH=%PATH%
    set PATH=c:\cygwin\bin;%DEF_PATH%
    set myargs=%*
    if "%myargs%" == "" goto noarg
    rem echo %myargs%
    bash --rcfile %HOME%/.bashrc -i -c "%myargs%" 
    c:
    rem pause
    sleep 1
    goto exit
    :noarg
 
    rxvt -e /usr/bin/bash --login -i
 
    :exit
    exit

Then I tested the script from the command line as follows, until I had the syntax just so:

?[Copy to clipboard]View Code BASH
c:
cd \cygwin
cygrun.bat cygwin_script arg1 arg2

Once I was able to run it happily, I added the scheduled task as follows:

?[Copy to clipboard]View Code BASH
    Run: C:\WINDOWS\system32\CMD.EXE /x /c start "Some title" /min
c:\cygwin\cygrun.bat cygwin_script arg1 arg2
    Start In: c:\cygwin     <-- must be a real disk drive and path
    Run as: domain\username

Unfortunately, I was never able to figure out how to redirect stdout and stderr. I tried plenty of variations on ">> /some/path/to/log.txt 2>&1″ with no joy. Instead, I just changed all the commands in the script and added that line on to each echo statement. Sad, but functional.

[Oct 10, 2009] Cygwin Bash Shell in rxvt Terminal

See also Better Cygwin Terminal

  • Bash Shell can also be run through the Cygwin's rxvt terminal distributed with cygwin. It is a colour vt102 terminal emulator intended as an xterm replacement. It can be launched without starting any X Window System. The terminal has some nice feature including familiar cut and paste operations (familiar to Unix users). It also offers better fonts.

  • Rxvt can be started by typing the following command in a command prompt window.

  • D:\Programs\Cygwin\bin\rxvt.exe -sl 500 -fn courier -bg wheat
    -sr -title "Bash Sailor" -e D:\Programs\Cygwin\bin\bash.exe --rcfile %HOME%\.bashrc
  • [Jun 23, 2009] d The Directory Lister (installed binaries and support files)

  • Among files

  • Thu Oct 9 00:36:24 2003 1249 usr/share/doc/Cygwin/d-1.2.0.README
    Thu Oct 9 00:36:25 2003 0 usr/share/doc/d-1.2.0/
    Thu Oct 9 00:36:25 2003 17992 usr/share/doc/d-1.2.0/COPYING
    Thu Oct 9 00:36:25 2003 5685 usr/share/doc/d-1.2.0/d.conf.example
    Thu Oct 9 00:36:25 2003 445 usr/share/doc/d-1.2.0/README
    Thu Oct 9 00:36:24 2003 0 usr/share/info/
    Thu Oct 9 00:36:24 2003 17027 usr/share/info/d.info
    Thu Oct 9 00:36:24 2003 0 usr/share/man/
    Thu Oct 9 00:36:25 2003 0 usr/share/man/man1/
    Thu Oct 9 00:36:25 2003 1915 usr/share/man/man1/d.1

  • Here is example of Tree printing

  • [0] [BezrouN@USBT92DD1:~] $ d -T
    /home/bezroun/:
      |-etc/:
      |   |-Hosts/:
      |   |-DIR_COLORS
      |   |-DIR_COLORS.xterm
      |   |-aix_functions
      |   `-dir_history
      |-telnet_test.pl
      `-telnet_test.pl~
    
  • [Jun 3, 2009] tech.erdelynet.com Cygwin - SSHD Setup

    Princeton University
    Use the following steps to successfully get OpenSSH working as a server:
    1. Set up your environment for Cygwin. For NT 4 and Windows 2000, this is done by right-clicking on My Computer and choosing Properties. In NT4, it's on the Environment tab. In Windows 2000, it's the Environment Variables on the Advanced tab. Add the following setting to the System Environment:
      • CYGWIN = ntsec tty
      Append the following variable to contain the following:
      • Path : ;C:\Cygwin\bin
      Note that if you are NT/2K on FAT(32), the ntsec option for the CYGWIN variable won't help you much. In these cases, just set CYGWIN to "tty". (Note: Through email, I've been notified that having CYGWIN=ntsec actually does made a difference on FAT(32) systems. Geoffrey Hoo)

    2. Download the Cygwin Setup Program into a temporary folder like C:\CygwinInstall.

    3. Run "C:\CygwinInstall\Setup.exe", choose " Install from Internet ", choose a suitable mirror (I like "ftp://mirrors.rcn.net").

    4. Now choose the packages you want to install. Click on the "+" next to "Admin" to expand it. Click on the word "Skip" next to the word cygrunsrv to install the NT/Win2k/XP Cygwin Service Initiator. Install cygwin-doc from "Doc", nano and/or vim from "Editors" and openssh from "Net".

    5. [Optional] After Setup is complete, I like to make a couple of changes to the default installation: - Download and install ftp://ftp.erdelynet.com/mike/cygwin/profile, ftp://ftp.erdelynet.com/mike/cygwin/sh_aliases into /etc. - Change the Cygwin icons so that, instead of pointing to cygwin.bat, they point to "c:\cygwin\bin\bash.exe --login -i" and start in "c:\cygwin\bin"

      NOTE: Unless specified otherwise, run the following commands within the Cygwin Bash Shell installed in your Start Menu.

    6. Now, you'll want to configure sshd. This is MUCH simpler than it used to be.
      Run "ssh-host-config -y" to set it up. This step will create necessary configuration files, a priviledge separation user and necessary directories. When prompted with "CYGWIN=" type what you set CYGWIN to in step 1 (tty ntsec).

    7. You will probably want to change permissions and ownership on some files:
      • cd /; chmod -R og-w .
      • chmod og+w /tmp
      • touch /var/log/sshd.log
      • chown system:system /var/log/sshd.log /var/empty /etc/ssh_h*
      • chmod 755 /var/empty

    8. Now you are ready to start the service: "cygrunsrv -S sshd"

    9. Test the service by running "ssh localhost"

    SSH Daemon - Setup with Cygwin - SecurityForest

    SecurityForest

    Tutorial by Loni
    How-to setup an SSH daemon using Cygwin (Only tested on windows 2000)

    Make sure you install the following:

    Admin -> Cygrunsrv
    Net   -> OpenSSH

    Edit the cygwin.bat file and add the CYGWIN environmental variable

    notepad d:\cygwin\cygwin.bat
    
    add the following:
        set CYGWIN=binmode tty ntsec	

    Start a cygwin bash console

    Configure SSH

    # ssh-host-config
        Should privilege separation be used? (yes/no) no
        Do you want to install sshd as service? (yes/no) yes

    Now you have a choice of the service being automatically or manually started

    Automatically Started:
     # cygrunsrv -S sshd 
    Manually Started:
        # net start sshd
        # net stop sshd
    

    [Jun 2, 2009] sshwindows.sf.net OpenSSH for Windows

    OpenSSH for Windows is a free package that installs a minimal OpenSSH server and client utilities in the Cygwin package without needing the full Cygwin installation.

    The OpenSSH for Windows package provides full SSH/SCP/SFTP support. SSH terminal support provides a familiar Windows Command prompt, while retaining Unix/Cygwin-style paths for SCP and SFTP.

    [Jun 1, 2009] HOWTO setup the Cygwin SSH daemon on a Windows 2003 server

    Note : This set of instructions has worked for me at our institution. You should read /usr/share/doc/Cygwin/openssh.README after installing cygwin and check the cygwin mailing list if you encounter problems.

    puttycyg - Google Code

    PuTTYcyg is a patched version of PuTTY that, in addition to telnet, rlogin, ssh, and serial connections, can also be used as a local Cygwin terminal instead of the Windows console or xterm. See README.txt for more information.

    Download the latest release (20071202).

    PuTTYcyg may require a recent version of Cygwin. PuTTYcyg version 20071202 has been tested with version 1.5.24-2 of cygwin1.dll and several users report success with 1.5.25.

    Problems? Please read the (very short) FAQ and the (very short) README before filing an issue.

    CygTerm - Yet another Cygwin console

    v1.07 - 2006/11/26 Copyright(C) 2000-2006 NSym.

    = Japanese / English =

    Overview of CygTerm

    In Cygwin, you can use a shell such as bash on the DOS window.
    However, using on the DOS window is inconvenient when you want to do window resizing, copy & paste, or etc.

    I guess many people may use Unix machines with a terminal emulator via Telnet.
    It is convenient to use Cygwin in the same way as it, that is to operate with a VT100 terminal emulator.
    At first you think that preparing inetd, in.telnetd and so on in Cygwin and login from a terminal emulator...

    But, here is another approach.
    In short it is to connect a terminal emulator and Cygwin shell directly.
    You simply use a terminal emulator instead of cygwin.bat DOS window without login.

    Idea

    The idea is to make a program which performs starting a terminal emulator and Cygwin shell, and relaying their I/O.
    When you run this program a specified terminal emulator starts up and the Cygwin shell command line prompt appears in it.
    screen shot

    Design

    Details of cygterm.exe
    
          [1] Prepare a listener socket to wait for a TELNET connection.
              Find out an unused TCP port number to assign to the socket from a specified range.
    
          [2] Invoke a terminal emulator in another thread.
              Then specify IP address `127.0.0.1' and the port number [1] in the command line arguments.
    
          [3] Accept the connection from the terminal emulator.
              Refuse it except a connection from `127.0.0.1' in security.
    
          [4] Do fork(), and in the child process, invoke a shell under PTY (pseudo terminal) slave side.
    
          [5] Relay I/O between the TELNET connection socket [3] and the PTY master side of [4].
    
    Support for TELNET protocol (options negotiation)
    
          Receive the notification of terminal-type from a terminal emulator,
          and apply it to the environment variable TERM on a shell.
    
          Receive the notification of terminal-size from a terminal emulator,
          and apply it to window size of PTY.
    
          [Ref. RFC854 TELNET PROTOCOL SPECIFICATION]
    
    cygterm.exe is implemented as an window-less Win32 application.
    

    Download

    Source Files

            README       -  description file
            README-j     -  original README in Japanese
            Makefile     -  MAKEFILE for installation
            cygterm.cc   -  program source code
            cygterm.cfg  -  configuration file
    download cygterm107.tgz (about 14kb) [for Cygwin-1.5.5-22+gcc-3.4, newer]
    download cygterm106.tgz (about 13kb)
    --- License ---
    CygTerm is a free software distributed under the terms of the GNU General Public License (GPL)
    published by Free Software Foundation. See GPL (http://www.gnu.org/copyleft/gpl.html).

    --- Note ---
    Any program including non-GPL program can invoke the CygTerm executable (cygterm.exe) and communicate with it.

    Install

    Do `make install' under Cygwin.

    - - - - - - - - - -
    Be sure to specify the install directory by BINDIR in Makefile in advance.
    cygterm.exe and cygterm.cfg are installed in BINDIR. cygterm.cfg is not overwritten.

    Configuration

    cygterm.cfg is a configuration file.
    This includes definitions for the command lines of a terminal emulator and a shell, and several parameters.
    cygterm.cfg is loaded from the same directory cygterm.exe exists in.

          An example of cygterm.cfg
          +-----------------------------------------------------------------------
          | TERM = C:\program files\ttermpro\ttermpro.exe %s %d /KR=SJIS /KT=SJIS
          | TERM_TYPE = vt100
          | PORT_START = 20000
          | PORT_RANGE = 40
          | SHELL = /bin/bash
          | ENV_1 = MAKE_MODE=unix
          | ENV_2 = HOME=/home
          |   :         :
    
        TERM
            This is the command line to execute a terminal emulaitor.  Specify the full path to the
            command if it isn't in Windows search path.  This needs to be described `%s' and `%d'
            for the host and port number.
    
        TERM_TYPE
            This terminal type is adopted when the terminal emulator did not give a terminal type.
            (default: vt100) Then this value is set to the environment variable TERM on a shell.
    
        PORT_START
            This is the minimum TCP port number allowed for use.  (default: 20000)
    
        PORT_RANGE
            This is the maximum number of TCP ports allowed for use.  (default: 40)
    
            cygterm.exe looks for an unused port number between PORT_START and PORT_START+PORT_RANGE,
            and therefore can be run concurrently as many as this number.
    
        SHELL
            This is the command line to execute a shell in Cygwin side (normally /bin/bash).
            Specify the full path to the shell.
    
        ENV_X
            This is the environment variable to be set when starting the shell.  It should be of the
            form `name=value' (like putenv).  It is possible to give as many environment variables
            as needed by beginning with "ENV_".
    

    Usage

    Command Line Options
    
            cygterm.exe [-t 'terminal-emulator'] [-p port-number] [-dumb]
                        [-s 'shell'] [-v 'env-var' ...]
    
            -t 'terminal-emulator'
                    Specify the command line of a terminal emulator to execute.
                    This format is the same as TERM in the configuration file.
                    The command line should be enclosed in quotes to include spaces.
    
            -p port-number
                    Instead of executing a terminal emulator, try connection to this
                    port number of localhost.  It is considered another program uses
                    `-p' option to use Cygwin via cygterm.exe.
    
            -dumb
                    Suppress the TELNET options negotiation.  And ignore any TELNET
                    commands sent from terminal side.  The environment variable TERM
                    is set to `dumb' on the shell side.
    
            -s 'shell'
                    Specify the command line of a shell on Cygwin to execute.
                    This format is the same as SHELL in the configuration file.
                    The command line should be enclosed in quotes to include spaces.
                    Any command can be specified even if a non-shell command.
    
            -v 'env-var'
                    Specify the environment variable to be set when starting the shell.
                    This format is the same as ENV_X in the configuration file.
                    The expression should be enclosed in quotes to include spaces.
                    One or more `-v' options are available.
    
    The terminal emulator or connection port number, and the shell on Cygwin, these need to be specified at least.
    If these are given in the command line, cygterm.exe can be run without configuration file cygterm.cfg.

    Recommended Links



    Etc

    Society

    Groupthink : Two Party System as Polyarchy : Corruption of Regulators : Bureaucracies : Understanding Micromanagers and Control Freaks : Toxic Managers :   Harvard Mafia : Diplomatic Communication : Surviving a Bad Performance Review : Insufficient Retirement Funds as Immanent Problem of Neoliberal Regime : PseudoScience : Who Rules America : Neoliberalism  : The Iron Law of Oligarchy : Libertarian Philosophy

    Quotes

    War and Peace : Skeptical Finance : John Kenneth Galbraith :Talleyrand : Oscar Wilde : Otto Von Bismarck : Keynes : George Carlin : Skeptics : Propaganda  : SE quotes : Language Design and Programming Quotes : Random IT-related quotesSomerset Maugham : Marcus Aurelius : Kurt Vonnegut : Eric Hoffer : Winston Churchill : Napoleon Bonaparte : Ambrose BierceBernard Shaw : Mark Twain Quotes

    Bulletin:

    Vol 25, No.12 (December, 2013) Rational Fools vs. Efficient Crooks The efficient markets hypothesis : Political Skeptic Bulletin, 2013 : Unemployment Bulletin, 2010 :  Vol 23, No.10 (October, 2011) An observation about corporate security departments : Slightly Skeptical Euromaydan Chronicles, June 2014 : Greenspan legacy bulletin, 2008 : Vol 25, No.10 (October, 2013) Cryptolocker Trojan (Win32/Crilock.A) : Vol 25, No.08 (August, 2013) Cloud providers as intelligence collection hubs : Financial Humor Bulletin, 2010 : Inequality Bulletin, 2009 : Financial Humor Bulletin, 2008 : Copyleft Problems Bulletin, 2004 : Financial Humor Bulletin, 2011 : Energy Bulletin, 2010 : Malware Protection Bulletin, 2010 : Vol 26, No.1 (January, 2013) Object-Oriented Cult : Political Skeptic Bulletin, 2011 : Vol 23, No.11 (November, 2011) Softpanorama classification of sysadmin horror stories : Vol 25, No.05 (May, 2013) Corporate bullshit as a communication method  : Vol 25, No.06 (June, 2013) A Note on the Relationship of Brooks Law and Conway Law

    History:

    Fifty glorious years (1950-2000): the triumph of the US computer engineering : Donald Knuth : TAoCP and its Influence of Computer Science : Richard Stallman : Linus Torvalds  : Larry Wall  : John K. Ousterhout : CTSS : Multix OS Unix History : Unix shell history : VI editor : History of pipes concept : Solaris : MS DOSProgramming Languages History : PL/1 : Simula 67 : C : History of GCC developmentScripting Languages : Perl history   : OS History : Mail : DNS : SSH : CPU Instruction Sets : SPARC systems 1987-2006 : Norton Commander : Norton Utilities : Norton Ghost : Frontpage history : Malware Defense History : GNU Screen : OSS early history

    Classic books:

    The Peter Principle : Parkinson Law : 1984 : The Mythical Man-MonthHow to Solve It by George Polya : The Art of Computer Programming : The Elements of Programming Style : The Unix Hater’s Handbook : The Jargon file : The True Believer : Programming Pearls : The Good Soldier Svejk : The Power Elite

    Most popular humor pages:

    Manifest of the Softpanorama IT Slacker Society : Ten Commandments of the IT Slackers Society : Computer Humor Collection : BSD Logo Story : The Cuckoo's Egg : IT Slang : C++ Humor : ARE YOU A BBS ADDICT? : The Perl Purity Test : Object oriented programmers of all nations : Financial Humor : Financial Humor Bulletin, 2008 : Financial Humor Bulletin, 2010 : The Most Comprehensive Collection of Editor-related Humor : Programming Language Humor : Goldman Sachs related humor : Greenspan humor : C Humor : Scripting Humor : Real Programmers Humor : Web Humor : GPL-related Humor : OFM Humor : Politically Incorrect Humor : IDS Humor : "Linux Sucks" Humor : Russian Musical Humor : Best Russian Programmer Humor : Microsoft plans to buy Catholic Church : Richard Stallman Related Humor : Admin Humor : Perl-related Humor : Linus Torvalds Related humor : PseudoScience Related Humor : Networking Humor : Shell Humor : Financial Humor Bulletin, 2011 : Financial Humor Bulletin, 2012 : Financial Humor Bulletin, 2013 : Java Humor : Software Engineering Humor : Sun Solaris Related Humor : Education Humor : IBM Humor : Assembler-related Humor : VIM Humor : Computer Viruses Humor : Bright tomorrow is rescheduled to a day after tomorrow : Classic Computer Humor

    The Last but not Least Technology is dominated by two types of people: those who understand what they do not manage and those who manage what they do not understand ~Archibald Putt. Ph.D


    Copyright © 1996-2021 by Softpanorama Society. www.softpanorama.org was initially created as a service to the (now defunct) UN Sustainable Development Networking Programme (SDNP) without any remuneration. This document is an industrial compilation designed and created exclusively for educational use and is distributed under the Softpanorama Content License. Original materials copyright belong to respective owners. Quotes are made for educational purposes only in compliance with the fair use doctrine.

    FAIR USE NOTICE This site contains copyrighted material the use of which has not always been specifically authorized by the copyright owner. We are making such material available to advance understanding of computer science, IT technology, economic, scientific, and social issues. We believe this constitutes a 'fair use' of any such copyrighted material as provided by section 107 of the US Copyright Law according to which such material can be distributed without profit exclusively for research and educational purposes.

    This is a Spartan WHYFF (We Help You For Free) site written by people for whom English is not a native language. Grammar and spelling errors should be expected. The site contain some broken links as it develops like a living tree...

    You can use PayPal to to buy a cup of coffee for authors of this site

    Disclaimer:

    The statements, views and opinions presented on this web page are those of the author (or referenced source) and are not endorsed by, nor do they necessarily reflect, the opinions of the Softpanorama society. We do not warrant the correctness of the information provided or its fitness for any purpose. The site uses AdSense so you need to be aware of Google privacy policy. You you do not want to be tracked by Google please disable Javascript for this site. This site is perfectly usable without Javascript.

    Last modified: February 18, 2020