tags:

views:

5648

answers:

4

I'm trying to safely update the home directory as specified in /etc/passwd, but the standard linux utils - usermod and vipw - for doing so aren't provided by cygwin. Could anyone tell me how they changed this in cygwin? If you know where these utils are hiding, that would be great.

+1  A: 

I always set HOME as a user-specific environment variable in Computer Properties.

JesperE
I'm trying to avoid that as it is set to a corporate network drive. Looks like it would work though.
sblundy
+2  A: 

I ended up exiting all my cygwin shells and editing it by hand in a text editor. So far, so good.

Note: don't escape the spaces in the "Documents and Settings" directory. The entry will look like:

user:...:/cygdrive/c/Documents and Settings/user:/bin/bash

The line is tokenized on the ':' character.

sblundy
+7  A: 

Like sblundy's answer, you can always edit by-hand.

But if you want to do it the "official" way, use the cygwin-specific mkpasswd command. Below is a snippet from the official docs on mkpasswd :

For example, this command:

Example 3.9. Using an alternate home root

$ mkpasswd -l -p "$(cygpath -H)" > /etc/passwd

would put local users' home directories in the Windows 'Profiles' directory.

There's a bunch of other really useful commands described on the Cygwin Utilities documentation page (which includes mkpasswd). The use of cygpath in the example above is another of these cygwin-specific tools.

While you're at it, you probably also want to read the Using Cygwin Effectively with Windows documentation. There's a bunch of really good advice.

netjeff
A: 

To avoid problems caused by having spaces in the path to your home directory, use the short-form of the Windows 'Profiles' directory - i.e. /cygdrive/c/DOCUME~1/user.

You can do this by typing the command:

$ mkpasswd -l -p "$(cygpath $(cygpath -dH))" > /etc/passwd