Cygwin64 HDF5 load() crash fix

Currently, Octave 3.8.1 in Cygwin64 was compiled with headers 1.8.12 but HDF5 library 1.8.13.

This causes Octave to seg fault Warning! ***HDF5 library version mismatched error*** and exit.

To avoid having to recompile, you can type
HDF5_DISABLE_VERSION_CHECK=1 octave
to startup octave
you can perhaps add to your ~/.bashrc file the line:
alias octave="HDF5_DISABLE_VERSION_CHECK=1 octave -q"

Matplotlib in Cygwin 64-bit for Python 3 and Python 2.7

It is pretty simple to install matplotlib for Python 3 and Python 2.7 in Cygwin.

prereqs:
pkg-config ghostscript libfreetype-devel libpng-devel python-gtk2.0 libgtk2.0-devel gcc-g++ git

Procedure:
git clone git://github.com/matplotlib/matplotlib.git
cd matplotlib
python setup.py install

or for python 3, do:
python3 setup.py install

result:
$ python
Python 2.7.5 (default, Oct 2 2013, 22:34:09)
[GCC 4.8.1] on cygwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib
>>> matplotlib.__version__
u'1.4.x'

$ python3
Python 3.2.5 (default, Oct 2 2013, 22:58:11)
[GCC 4.8.1] on cygwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib
>>> matplotlib.__version__
'1.4.x'

Note: to actually use matplotlib to create a visible figure, you need a basic X11 system running (install xinit, etc in Cygwin) and type
startx
and then start python from inside X11 terminal.

rsync to EXFAT drive

When syncing with the usual rsync Linux options:
rsync -av --progress --stats /source/a/ /dest/a
to an EXFAT drive, you’ll get errors like:

rsync: mkstemp … failed: Function not implemented (38)

because EXFAT doesn’t understand permissons, owners, or groups. So let’s pick out the options from -a that aren’t friendly with EXFAT.

rsync -vrltD --progress --stats /source/a/ /dest/a

should work for you. Try it with some small files first (yes, you can rsync individual files).
You can watch rsync progress on big files (verifying they’re actually being written to the new HDD) by viewing hidden files — rsync uploads to the destination HDD by prepending a dot . to the filename.

nmap with Cygwin

As of this writing, nmap is not built-in to Cygwin. Here is how to install and configure nmap so that you can call nmap seamlessly from Cygwin:

1) Download and install the “self-installer” from

http://nmap.org/download.html#windows

You do NOT need the WinPCap services, I unchecked those options.

2) in cygwin, type nano .bash_profile and add the line:
alias nmap="/cygdrive/c/Program\ Files\ \(x86\)/Nmap/nmap.exe"

3) close and reopen your Cygwin window

Now, when you type nmap in Cygwin terminal you should now see the nmap help text.

7-zip unavailable in 64-bit Cygwin

At the time of this writing, 7-zip was still not available in 64-bit Cygwin.
Here’s how to work around this issue by using the Windows 7z.exe from Cygwin. NOTE: This method will not show percent complete (no progress report).

1) install the 64-bit 7zip for Windows from http://www.7-zip.org/
2) in Cygwin, type nano ~/.bashrc and at the bottom, paste in the line:
alias 7z="/cygdrive/c/Program\ Files/7-Zip/7z.exe"
3) close and reopen Cygwin and you’ll find that you can 7-zip files as usual.

Example usage:
say you have a big file named huge.dat. To archive this file type:
7z a huge.7z huge.dat

to extract the file type
7z e huge.7z

Making Cygwin SSH server for Windows

One of the great things about using Cygwin SSHD is you also have access to the full suite of Cygwin tools like Octave, Imagemagick, etc.

note, I won’t get into security setting here–but at least consider using Public Key Authentication — it’s much stronger than any human usable keyboard password.

Procedure:
1) run “setup-x86_64.exe” and install “openssh”
2) start Cygwin64 using “Run as Administrator” and type ssh-host-config
3) here are some suggested answers to the configuration script questions:
Priviledge separation? YES
sshd as service? YES
value of CYGWIN for daemon? (just press Enter key, don’t type anything)
use a different name? no (you want to use cyg_server)
4) in Cygwin64, type cygrunsrv -S sshd
5) now try to login to your SSH server from another PC. Under services.msc you should see the Status “started” for service “CYGWIN sshd”, and under the General tab the “path to executable” should be something like
c:\cygwin64\bin\cygrunsrv.exe
6) to configure your SSH server (optional), type in Cygwin64:
nano /etc/sshd_config
to make the changes take effect, type
cygrunsrv -E sshd
cygrunsrv -S sshd

If you get “system error 1069 has occurred. The service did not start due to a logon failure”, check the password on your “priviledged server” cyg_server — maybe you typed it wrong.

Removing sshd daemon in Cygwin

One reason you might want to disable/remove the sshd daemon is upgrading from 32-bit Cygwin to 64-bit Cygwin

WARNING: This procedure disables SSH access to your PC. You will have to have another means (e.g. physically being at the keyboard or RDP directly on port 3389) to access the PC again!

To disable SSHD server on Cygwin:
1) open Cygwin using “Run As Adminstrator”, and type:

cygrunsrv -E sshd
cygrunsrv -R sshd

2) reboot and verify that you CAN’T connect to your former SSH server. You won’t see “CYGWIN sshd” in services.msc anymore, either.