18

I recently installed cygwin, and have been unable to find my passwd/etc file in order set to HOME. Is there any way to force cygwin to generate the file?

0x6
  • 241
  • 1
  • 2
  • 6
  • Did you mean /etc/passwd? I checked its creation date on my PC, which was almost the same as Cygwin.ico. /etc/passwd was created 3 minutes before the icon file. Which means that it was created during the install (2013.09.19). – szkj Feb 19 '15 at 00:18

2 Answers2

31

The /etc/passwd and group files are no longer generated by default, starting with Cygwin 1.7.34.

You can still generate them. Cygwin will use these files preferentially if present, by default, but only to cater to existing installs and special situations.

When these files are not present, Cygwin now uses the native Windows user management mechanisms: Active Directory where present, or SAM where not.

It is therefore recommended that you use this new mechanism to change your home directory. The easiest way I know of to do this is to add a line like this to your /etc/nsswitch.conf file:

db_home: /%H

That will change your Cygwin home directory to be equal to your Windows user profile directory. There are many other legal % tokens you can use here to achieve different results. See the previous link for details.

Taz
  • 1,235
  • 9
  • 16
Warren Young
  • 40,875
  • 8
  • 85
  • 101
  • So where are they in the Win dir if they were created? – square_eyes Jul 07 '15 at 10:36
  • @square_eyes: They're not in the Windows directory at all. `/etc/passwd` and `/etc/group` are POSIX paths, not Windows paths. By default, `/etc` is part of the Cygwin root, so it appears as as `c:\cygwin\etc` or `c:\cygwin64\etc`, if you used the default Cygwin installation directory. The mechanism that maps Windows paths to POSIX paths is [configurable](https://cygwin.com/cygwin-ug-net/using.html#mount-table), however, so these files could be elsewhere. – Warren Young Jul 07 '15 at 11:11
  • This `db_home` approach has saved me after many hours of googling – dubnde Apr 12 '16 at 21:35
4

In my case, I set db_home: /%H in /etc/nsswitch.conf file, and change permission of my .ssh dirctory to "full control".

Oskar
  • 2,522
  • 32
  • 37