I've installed Cygwin but have trouble operating it conveniently. I'd like the ability to, for example, 'su peter' where peter has his own preference for home directory, and shell. I don't care about security. I do not need these "user accounts" to be visible to Windows' mechanisms.

I've been stymied in my efforts. I don't know how to set "no password required" in /etc/passwd. 'su' gives command not found.

(BTW, I did install Cygwin on a different machine several years ago with no problem. Am I fighting with recent "improvements"?)

Let me clarify my question. The facilities from /etc/passwd are: * assign a home directory. I want george and peter to have different directories. I do not care whether george and peter can modify each others files or not * I want george to be able to use a different shell from peter. I don't want goerge to need to type ** tcsh ** cd /home/george ** source .cshrc for every single shell that gets spawned. Is there an easy way to achieve this? Does the Windows facility even have the concept of preferred Cygwin shell?

  • Answer expanded to address your "clarification" – DavidPostill Feb 16 '16 at 12:41

I don't care about security.

I do not need these "user accounts" to be visible to Windows' mechanisms.

Every Cygwin user must have a corresponding Windows user.

How do I add a new user in Cygwin?

  1. Create a Windows User

    • Create the user in Windows (Start > Control Panel >Manage User Accounts > Add...)
  2. Create the corresponding Cygwin user

    • Run the following commands:

      mkpasswd -l > /etc/passwd
      mkgroup -l > /etc/group 
    • This will synchronise the Cygwin users and group with the Windows user account.

    • If you are in a Domain use -d instead of -l

  3. Set the users shell

    • Change the user's default shell as appropriate by modifying /etc/passwd (which is a plain text file

    • The format of the file is as follows:

  4. Modify the user home directory permissions as appropriate for you needs

I don't know how to set "no password required"

If you really don't care about security and want no password use:

password -p username

From the passwd documentation:


passwd [OPTION] [USER]



-p, --pwd-not-required no password required for USER.

Source passwd

Am I fighting with recent "improvements"?

From Cygwin version 1.7.34 onward /etc/passwd is no longer used by default to manage user accounts.

  • If /etc/passwd exists it will be used, but only to cater to existing installs and special situations.

  • If /etc/passwd doesn't exist you can still create it. See mkpasswd and mkgroup for more information.

Since version 1.7.34 Cygwin uses uses native Windows user management.

  • Active Directory if it is available,
  • SAM otherwise.

You should use the new mechanism to manage user accounts instead of /etc/passwd:

Starting with Cygwin 1.7.34, Cygwin uses an automatic, internal translation from Windows SID to POSIX UID/GID. This mechanism, which is the preferred method for the SID<=>UID/GID mapping, is described in detail in the Mapping Windows accounts to POSIX accounts.

Prior to Cygwin 1.7.34, the last part of the SID, the so called "Relative IDentifier" (RID), was by default used as UID and/or GID when you created the /etc/passwd and /etc/group files using the mkpasswd and mkgroup tools. These tools as well as reading accounts from /etc/passwd and /etc/group files is still present in recent versions of Cygwin, but you should switch to the aforementioned automatic translation, unless you have very specific needs. Again, see Mapping Windows accounts to POSIX accountsfor the details.

Source POSIX accounts, permission, and security:

su gives command not found.

Install sshd and use ssh username@localhost as a su replacement.

You can define a su alias to make this easier.

Why doesn't su work?

The su command has been in and out of Cygwin distributions, but it has not been ported to Cygwin and has never worked. It is currently installed as part of the sh-utils, but again, it does not work.

You should rather install sshd and use ssh username@localhost as a su replacement.

For some technical background into why su doesn't work, read About the 'su' command and related mail archive messages.

Source Why doesn't su work?

  • I'm happy to use /etc/passwd even if it is no longer the preferred way to go, if it can meet my objectives. Please read my clarification above. – James Dow Allen Feb 16 '16 at 12:07
  • @JamesDowAllen Answer expanded to address your "clarification". – DavidPostill Feb 16 '16 at 12:39
  • I've followed the instructions. I've learned that the password field in /etc/passwd is stored plaintext -- that makes that part easy. :-) BUT ssh peter@localhost gives me Internet connection refused (obviously I'm not intending to use internet) while ssh peter gives me "Could not resolve hostname". login works better -- but still doesn't succeed: I get "no shell: /usr/bin/tcsh: no such file or directory" This despite that that file does exist; I've used it successfully; my desire for this alternate is convenience. So ... thanks for the help! More help will be gratefully accepted. – James Dow Allen Feb 16 '16 at 17:32
  • @JamesDowAllen I don't know how to fix ssh (I don't use it). This link suggests that some tools (mintty) honour the passwd shell. It also gives you other ways to change the shell. Re: How does one change the default shell?. You might want to read the rest of that thread. – DavidPostill Feb 16 '16 at 17:39
  • 1
    Now that’s an impressively thorough answer. I find it hard to believe that it was neither accepted or upvoted (until now). – Anthony G - justice for Monica Sep 1 '16 at 13:16

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.