I'm attempting to set up OpenSSH on a bunch of Windows Server 2003 machines in an automated fashion. My goal is to be able to do so using a single version of Cygwin installed on a network drive instead of manually installing it on each machine.

I can install cygwin just fine, but start running into problems when I try to run ssh-host-config.

$ ssh-host-config
bash: /usr/bin/ssh-host-config: Permission denied 

Ok, not a big deal. I chmod 555 everythingin /usr/bin.

$ ssh-host-config
/usr/share/csih/cygwin-service-installation-helper.sh: line 689: /usr/bin/awk: cannot execute binary file

This is where I get stuck. Running

petters@BTSOTTSTBAL507 /usr/bin
$ awk
bash: /usr/bin/awk: cannot execute binary file

Here are the contents of awk:


Just as a note, I can run gawk.exe just fine and have tried installing Cygwin with the CYGWIN=winsymlinks environment variable set.

I have also noticed the following -

petters@BTSOTTSTBAL507 /usr/bin
$ ls -l
total 366592    
-rwxr-xr-x 1 ???????? ????????   54798 Feb  4 19:02 [.exe
-rwxr-xr-x 1 ???????? ????????   23566 May 18  2010 addftinfo.exe
-rwxr-xr-x 1 ???????? ????????  165806 May 18  2010 afmtodit
-rwxr-xr-x 1 ???????? ????????    1786 May 17  2010 apropos
-rwxr-xr-x 1 ???????? ????????   47118 Feb  4 19:01 arch.exe
-rwxr-xr-x 1 ???????? ????????    8206 Apr 29 00:43 ascii.exe

In other words, the ownership data is messed up.

My impression is that cygwin 1.7.x was portable but maybe not? Any help is appreciated!


There are 2 issues you're facing.

First up is the difference between Cygwin's posix-y view of permissions and ownership vs Windows. You'll want to read Using Windows security in Cygwin. The ???????? is displayed because the files are owned by a user that is not defined on the local machine. If you're in a domain, you can probably run mkpasswd and mkgroup and using the output to create appropriate /etc/passwd and /etc/groups. However, they will only include the machine-specific accounts of the host where they were created.

Which segues nicely to the second issue:

Cygwin saves most of its configuration settings in or under /etc. So sharing /etc across multiple hosts is very difficult. Likewise, most Cygwin processes will assume /tmp and /var are also machine specific.

You might be able to get this to work by creating local directories on each machine, such as: c:\cygwin\etc, c:\cygwin\tmp, and c:\cygwin\var. You will need to populate etc and var with the expected files and directories. Then you'll need to create a /etc/fstab that brings all of these together into a complete filesystem. You'll want to read Mapping path names for more on that.

Also keep in mind that any time your network drive is unavailable, any running Cygwin processes may hang, crash, or just behave oddly.

  • Thank you - I have some homework to do before I'll be able to get this to work but your answer points me in the right direction.
    – dpetters
    Jul 6 '11 at 16:08
  • Yeah, this seems like a bad solution. Ideally, you would script some sort of installer for Cygwin and deploy that. Having said that, I don't believe that the setup.exe for Cygwin can be scripted, or read an answer file, etc. You could wrap it in an MSI using a packager, I suppose.
    – mfinni
    Jul 6 '11 at 16:17
  • Or : stackoverflow.com/questions/745275/…
    – mfinni
    Jul 6 '11 at 16:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.