X-Spam-Check-By: sourceware.org Message-ID: Date: Tue, 29 Aug 2006 10:21:48 -0700 From: "Grant Miller" To: cygwin AT cygwin DOT com Subject: Re: Unable to automatically map a drive letter at login In-Reply-To: <44F46A25.2070500@cygwin.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <44F46A25 DOT 2070500 AT cygwin DOT com> X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com On 8/29/06, Larry Hall (Cygwin) wrote: > Grant Miller wrote: > > 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. > > > > > > Sounds like the drive you're selecting is already mapped by the server to > your user. If you cannot unmap it, try a different (and free) drive letter. > Alternately, just omit the drive from your command and then access it with > UNC paths or mount it somewhere in your POSIX file system. I just rebooted one of the Windows systems and tried to SSH in to a now clean system (nobody else logged in since booting) with ssh keys and a script in my .bash_profile to attach to a drive letter and I got the same error (System error 85 has occurred). I also changed the drive letter the script was trying to map from h: to q: (a random drive letter that I haven't used before) and I still got the same error. Omitting the drive letter and using UNC paths works, but it's not going to be pretty. -- - Grant Miller -- 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/