Cygwin users and groups

This post is also available at my personal web site:

When you first install cygwin and run bash, it’ll usually display this error message:

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.

If you happen to be in a corporate environment with a huge active directory, then the mkpasswd(1) command can take a very long time. A quicker way to fix this issue (provided only the current user uses cygwin on this machine, which is most likely) is to issue this command instead:

mkpasswd -l -c > /etc/passwd; mkgroup -l -d > /etc/group

The mkgroup(1) command will still take a few minutes to complete, but typically there are much fewer groups than users, so it’s bearable.

16 thoughts on “Cygwin users and groups

  1. mkpasswd -l -c > /etc/passwd; mkgroup -l -d > /etc/passwd

    Fehler: copy paste bei mkgroup es muß natürlich
    /etc/group heißen nicht /etc/passwd

    Es handelt sich also um ungetesteter code. Bitte nicht



  2. If you arent Domain user and use Cygwin only localy
    the right way is:

    mkpasswd -l -p /home/ -c > /etc/passwd
    mkgroup -l -c > /etc/group

    use the -p option otherwise you will find your home
    in the deep stack of shit within windows. Nothing will
    work again and your children will cry.

  3. Pingback: nino’s blog » Blog Archive » Cygwin - Vista

  4. Pingback: betweenGo » Setting up cygwin users and groups

  5. hi all

    I ran the following command after updating cyqwin

    mkpasswd -l -p /home/ -c > /etc/passwd
    mkgroup -l -c > /etc/group

    The problem now is that I cannot access shared libraries for NS2 simulator in different users settings how can i solve this I need different ns versions on different users

  6. Thanks so much for posting this, I had been searching forever and unable to fix this problem until I found this site.

  7. What about domain users who are working remotely and aren’t connected to the local network their company’s active directory server is on?

    The mkgroup -l -c command gives an error message: mkgroup (195): [1789] The trust relationship between this workstation and the primary domain failed.

    • Yes I’m currently in the same boat 🙂

      Assuming that you have some sort of VPN to the company, it should work, although if it is working for me, it’s very, very slow (HP has a huge directory). I’ve given up waiting for it and will probably run this command when next I’m in the office. However I understand that’s a cop-out…

    • I ran mkgroup -d at work. It took over 3 hours and still I ended up with my group being “mkgroup”. I ended up doing this:

      mkgroup -l > /etc/group
      mkgroup -c >> /etc/group

      which seems to have fixed for my current situation (cygwin 1.7 on Vista)

  8. Hi,

    I am a newbie to Cygwin. I have installed the complete package of cygwin. Is there a possbility to access my unix server partitions directly using cygwin’s bash shell from windows ?

    • @Karthik: I am not sure how you mean “access my unix server partitions directly”.

      Do you mean you have a dual-boot PC and want to access the Unix disc partitions from within Windows/cygwin? Cygwin doesn’t do this, but if your flavour of Unix partitions is ext2fs or later, there are Windows ext2fs drivers

      Do you mean, you have a second computer that runs Unix and you want to access it’s filesystem to browse in Windows/cygwin? You can ssh to the Unix box from within bash (ssh user@server_address). Better would probably be to use Cygwin’s setup tool to install midnight commander for cygwin and then use the fish protocol from within mc: cd /#sh:user@server_address/directory

Comments are closed.