How do I change the default home directory after I fire up cygwin?

Andrew DeFaria Andrew@DeFaria.com
Tue Jan 22 17:58:00 GMT 2013


On 1/22/2013 8:31 AM, Andrey Repin wrote:
> Greetings, Yves!
>
>> I start up cygwin and do pwd, and this is my home directory.
>> $ pwd
>> /cygdrive/h
>> But, I don't want it to be in /cygdrive/h.  So, what gives?  I've run the
>> mkpasswd command like so (while in my /home/<my name> directory):
>> mkpasswd -l -p "$(cygpath -H)" > /etc/passwd
>> At that point, I close my cygwin window and open it again... and same thing
>> when I run pwd.  How do I make cygwin think and start in /home/<my name>?
>> I've even mucked with the /etc/passwd for my user account and STILL no
>> result.
>> Very confused...
> Check the contents of your $HOME variable.
Yes, check the contents of your $HOME environment variable as set in 
Windows (not Cygwin) by looking at My Computer: Properties: Advanced: 
Environment Variables. Check both User and System Environment variables 
sections (user will override system). It is common in corporate 
environments to use the H drive to point to some remote file system that 
gets mounted at boot time. That's your real home directory and often the 
same home directory you'll use on Unix/Linux machines should your 
company have any of them. Sharing a home directory is a good thing.

As for /etc/password and /home/<userid>, what I usually do is figure out 
what this H drive points to and then add something like the following to 
/etc/fstab and do a mount -a:

    //<server>/<share>   /home/<userid> ntfs           
    binary,posix=0,user 0 0

and make sure your line in /etc/passwd sets your home directory to 
/home/<userid>. In this manner everybody's happy and no matter which 
architecture you're on (Windows/Linux/Solaris/etc) home is always 
/home/<userid>...

There's no place like $HOME... :-)
-- 
Andrew DeFaria <http://defaria.com>
This space for rent


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list