This is the mail archive of the cygwin 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: Unable to automatically map a drive letter at login


Grant Miller wrote:
On 8/29/06, Larry Hall (Cygwin) <reply-to-list-only-lh AT cygwin DOT com> wrote:

<http://cygwin.com/acronyms/#PCYMTNQREAIYR>. Thanks.



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@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@WINDOWS2:~%
>
> Net use shows that there's nothing else mounted:
>
> grant@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.


Beauty is in the eye of the beholder. ;-)

--
Larry Hall                              http://www.rfk.com
RFK Partners, Inc.                      (508) 893-9779 - RFK Office
216 Dalton Rd.                          (508) 893-9889 - FAX
Holliston, MA 01746

--
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/


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