This is the mail archive of the mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: SSH into XP: mapped network drives disappeared!

Alexis Huxley wrote:

The short version

How do I stop XP from hiding my mapped network drives from me, when I make a slogin to XP using Cygwin+SSH?

Short answer: Use UNC paths instead of mapped drives.

The long version

Hi :-) I've hunted a lot on the web and mailing list archives, so I know a lot of people have had this same problem, but I haven't seen anybody answer it in a way that worked for me yet, so ...

I downloaded and installed Cygwin yesterday on a XP system where my home is not local: the passwords are managed centrally (a 'domain'  account, right?) and the disk space is on a SAN/NAS thing, which
is accessible to XP and to Unix machines.

As 'Administrator' I ran the 'mkpasswd -l -d > /etc/passwd' and the same for the groups file. (Actually first I tried it as myself, but with the '-d' option it bombed out before getting the entry for me with 'mkpassed: [5] Access denied', so then I tried as Administrator and everything went well.)

I modified my $HOME in /etc/passwd to be /cygdrive/y, which the XP PC has mapped to my home directory in the storage server. My ~/.profile sufficiently OS-independent, that this works under Cygwin/XP and on any of the various Unixes we run. Great so far.

I didn't think that Cygwin paid attention to the home field in /etc/passwd. Mine does, but that's because I modified /etc/profile to set $HOME based on /etc/passwd's home field.

Also, I use mounts instead of mapped drives or even UNC paths in /etc/passwd. So I do a:

$ mount -bsf //<server>/<share> /us

Note that I use /us for US and /china for China here at work since we have another office in China. Then I modify /etc/passwd to have /us/<username> for home and remember that /etc/profile has been modified to set $HOME to the home field in /etc/passwd (e.g. /us/adefaria).

One of the Cygwin components installed was SSH. I configured the server as explained at

Why not follow /usr/share/doc/Cygwin/openssh-3.7.1p2-1.README instead?

Ok, so now, when I run Cygwin from the XP machine itself (i.e. not through slogin) then I see the following network drives:

pc004545$ pwd
pc004545$ ls
<stuff in my home>
pc004545$ cd /cygdrive pc004545$ ls c d g h y pc004545$

(My ~/.profile is changing the prompt from the Cygwin default.)

Now for the problem: when I 'slogin' into the XP box, I have no problems being authenticated (not after I ran mkpasswd as 'Administrator' anyway), but '/cygdrive/y' is 'invisible' to my login shell, and I get a whole slew of errors accordingly:

pc004545$ slogin localhost
ahuxley@localhost's password:
Could not chdir to home directory /cygdrive/y: No such file or directory
mkdir: cannot create directory `/cygdrive/y': No such file or directory
Copying skeleton files.
These files are for the user to personalise
their cygwin experience.
These will never be overwritten.
/usr/bin/install: cannot create directory `/cygdrive/y': No such file or directory
/usr/bin/install: cannot create directory `/cygdrive/y': No such file or directory
/usr/bin/install: cannot create directory `/cygdrive/y': No such file or directory
-bash: cd: /cygdrive/y: No such file or directory
ahuxley@PC004545 /etc/skel <---- all of this is the prompt
$ <---- still part of the prompt

'net use' before the 'slogin' shows the Y: drive, and obviously I can cd to /cygdrive/y. 'net use' after 'slogin' shows Y: is there but "not available", and attempting to cd to /cygdrive/y obviously fails.

I've read, and indeed this 'net use' check seems to confirm, that this is not a Cygwin problem at all, but an XP problem.

My understanding is that network mapped drives will be marked Unavailable IFF you did a "passwordless" login (however you managed to accomplish a "passwordless" login). However I just tried an ssh passwordfull login and mapped drives are listed as Unavailable! Guess my understanding of this is screwed up!

So the question: what do I have to do XP to make it stop hiding my mapped drives from my when I slogin?

Personally I would seek to avoid the problem by not using mapped drives and instead either fully qualifying paths as UNC names or, in the case of a true Cygwin environment, using mounts.

Oh, one more thing: I saw people saying that you can just use 'net use ...' but assign different drive letters each time. Unfortunately, since the drive I want to map is my home directory, and path to this (as it appears on the PC) is written in /etc/passwd, and I can't/won't change /etc/passwd for each concurrent SSH I start, the solution must be one which makes the drive have a consistent mount/access point under XP.

Also note, that the shell tries to put me in that home *before* /etc/profile or ~/.profile are run, so some sort of 'net use <next-letter> //server/path; ln -s ....' in /etc/profile probably isn't going to cut it.

Does anybody know the 'correct' solution to this problem? Many thanks!

Alexis Huxley

-- Why is the alphabet in that order? Is it because of that song?

Unsubscribe info:
Problem reports:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]