Ben Biddington

Whatever it is, it's not about "coding"

Posts Tagged ‘cygwin

SSH, cygwin and domain users

leave a comment »

Yes you can log in to your local computer via ssh with a domain account.

If it seems you can’t (i.e., your password is rejected) then you  most likely need to export your user accounts and groups so cygwin can see them.

Another clue that you need to export is if you get a message like:

Your group is currently "mkpasswd".  This indicates that
the /etc/passwd (and possibly /etc/group) files should be rebuilt.
See the man pages for mkpasswd and mkgroup then, for example, run
mkpasswd -l [-d] > /etc/passwd
mkgroup  -l [-d] > /etc/group
Note that the -d switch is necessary for domain users.

To export domain users:

$ mkpasswd -d >> /etc/passwd

To export groups:

$ mkgroup > /etc/group


Errors logging in as domain user

2 [main] -bash 31884 C:\cygwin\bin\bash.exe: *** fatal error - couldn't dynamically determine load address for 'WSAGetLastError' (handle 0xFFFFFFFF), Win32 error 126
Connection to localhost closed.

This is because the cygwin sshd service must also run as domain account. I solved this by changing the user to my domain account.

Written by benbiddington

4 August, 2010 at 13:37

Grepping lines with multiple matches

with one comment

I want to filter log files by matching lines that contains all of  set of matches (I don’t want to alternate them).

For example lines like:

RawURL /1.2/user/authorize?ip=

I want to match lines that contain the terms “RawURL” and “/1.2/user/authorize?” without resorting to piping multiple greps:

$ grep RawURL | grep /1.2/user/authorize? *.txt

This means I want a regexp like:


Translating to grep extended regex, this becomes:

$ grep -E RawURL.+/1.2/user/authorize *.txt

Note: There is no need to enforce non-greedy matching.

Regular expressions, character classes and special characters

The expression:


Is not equivalent to:


Because in the second one, the special character ‘.’ is no longer special. Character classes have all special characters turned off.

Written by benbiddington

23 October, 2009 at 13:37

Posted in development

Tagged with , , ,