tags:

views:

569

answers:

3

I just installed Cygwin, and it looks like the home directory in the bash prompt is on my Z: drive. That's not where I want it.

How can I change this?

+4  A: 

It's the second-to-last element on your user's line in /etc/passwd. (Actually, the HOME environment variable takes precedence, but it's better to do it in /etc/passwd.)

If you don't have an /etc/passwd, or it's blank, you didn't run mkpasswd as instructed the first time you ran Cygwin.

See this FAQ item.

Warren Young
I like this answer better than mine.
mobrule
+1  A: 

Change your HOME environment variable.

on XP, its right-click My Computer >> Properties >> Advanced >> Environment Variables >> User Variables for >> [select variable HOME] >> edit

Michael Paulukonis
This will change your HOME environment variable for all your Windows applications, too.
mobrule
Very true. But what Windows applications do you have that use the HOME variable? I have EmacsW32 and.... Cygwin. Since I installed Emacs first, that's where my cygwin home lies, as well.
Michael Paulukonis
A: 

I happen to use cwRsync (Cygwin + Rsync for Windows) where cygwin comes bundled, and I couldnt find /etc/passwd.

And it kept saying

Could not create directory '/home/username/.ssh'.
...
Failed to add the host to the list of known hosts (/home/username/.ssh/known_hosts).

So I wrote a batch file which changed HOME variable before running rsync. Something like:

set HOME=.
rsync /path1 user@host:/path2

And viola! .ssh folder appeared in current working dir and rsync stopped annoying with rsa fingerprints.

It's a quick hotfix, but later you should change HOME to a more secure location.

TEHEK