delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/08/29/11:38:27

X-Spam-Check-By: sourceware.org
Message-ID: <c0a19ddd0608290838s50df9729m8e808aa0852c46b8@mail.gmail.com>
Date: Tue, 29 Aug 2006 08:38:06 -0700
From: "Grant Miller" <grantmiller1 AT gmail DOT com>
To: cygwin AT cygwin DOT com
Subject: Unable to automatically map a drive letter at login
MIME-Version: 1.0
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

My apologies if this question has been asked before.  I've spent a bit
of time searching through the mailing lists looking to see if someone
else has run into this issue.  I've seen similar issues, but no real
solutions provided.

Okay, here we go.

I have 3 Windows systems (XP Pro, 2003 Server, XP Pro 64bit) that all
have Cygwin installed on them.  Running uname -a returns:

CYGWIN_NT-5.2 SMTWIN2 1.5.21(0.156/4/2) 2006-07-30 14:21 i686 Cygwin

I have ssh installed on these systems and I'm running sshd on them as well.

I have a Samba server that's the PDC for our little group of Windows
systems.  It's running on a Solaris 8 box.  We're running Samba v2.2.8
(I know, it's old).

On the Windows systems, I setup users in /etc/passwd using "mkpasswd
-d DOMAIN -p /home -u username >> /etc/passwd".  I edited
/etc/password and changed the gid for the user from 11021 (some domain
GID) to 545 (local user GID).

I can ssh into the Windows systems from my desktop (or any other
system in our environment) without any issues.  I have setup ssh keys
so that I can ssh into the Windows systems without having to supply my
password.  That works great.

The next thing I wanted to do was to map drives from the Samba server
(particularly my home directory) when I ssh'd into the Windows
systems.  I created a simple file called mounts.bat in my cygwin home
dir on the Windows system that has a bunch of "net use" commands in
it:

net use h: \\sambabox\grant
net use t:  \\sambabox\tools

I call this script from my .bash_profile so it will map these drives
each time I login.

I ssh into the system using my ssh keys and it's unable to map the drives:

C:\cygwin\home\grant>net use h: \\sambabox\grant
System error 85 has occurred.

The local device name is already in use.


If I move aside my ~/.ssh/authorized_keys file on the Windows system
and ssh in again (this time providing my password), it's able to map
the drives without any problem.

At this point, I understand what's happening (99% sure).  When I login
without using ssh keys and provide my password, something (Cygwin,
Windows) is caching my password or login credentials and passing those
along to the net use command.

When I use ssh keys and don't type in my password when logging in,
there's no password or whatever to pass along to net use.


The next thing I tried was setting my username and password in the net
use command.

net use h: \\sambabox\grant  mypassword  /user:DOMAIN\grant /persistent:no

I'm running into the same problems above.  This command fails when I
try to ssh in using ssh keys, but works when I provide a password.

grant AT envy:~ % ssh windows2
Last login: Tue Aug 29 08:14:24 2006 from envy.apple.com
Fanfare!!!
You are successfully logged in to this server!!!

C:\cygwin\home\grant>net use h: \\sambabox\grant mypassword
/user:DOMAIN\grant /persistent:no
System error 85 has occurred.

The local device name is already in use.

grant AT WINDOWS2:~%

Net use shows that there's nothing else mounted:

grant AT WINDOWS2:~% net use
New connections will not be remembered.

There are no entries in the list.


The end goal for me is to setup these Windows systems so that multiple
people can login and get to their samba-mapped drives.  And to have it
work with ssh keys (no passwords) and automatically mapping the drives
at login.

I have all the pieces working (multiple people logging in, ssh keys),
just not the final piece (ssh keys and automatically mapping drives).

Sorry for being long-winded, I felt it was necessary to describe how I
have things setup and what I've done so far.

If anyone can help with this, I would really appreciate it.


-- 

- Grant Miller <grantmiller1 at gmail dot com>

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019