Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm 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 From: "Jason B. Alonso" To: Subject: RE: Problems with net use statement via sshd on cygwin Date: Tue, 8 Apr 2003 19:39:18 -0400 Message-ID: <069c01c2fe28$1313b200$3b03f712@mit.edu> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal In-Reply-To: X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Importance: Normal Hello, I frequently rely on the per-user nature of the net use command through ssh. So much so, in fact, that I wrote shell scripts that allow me to encrypt other shell scripts (namely, those that contain multiple net use commands with passwords) using gpg into self-extracting+executing (with help of passphrase) secured shell scripts. If there is interest, I can post my script-making scripts. I should add that I never map the drives, but rather run "net use \\server\some-share /USER:domain\user password" (backslashes are more prevalent than they appear) and use symbolic links into //server (yes, I leave off the share, so I can "cd /net-link/another-share" into whatever share I want). Regards, Jason Alonso -----Original Message----- From: cygwin-owner AT cygwin DOT com [mailto:cygwin-owner AT cygwin DOT com]On Behalf Of Igor Pechtchanski Sent: Tuesday, April 08, 2003 11:10 AM To: Eric Hanchrow Cc: cygwin AT cygwin DOT com Subject: Re: Problems with net use statement via sshd on cygwin On 7 Apr 2003, Eric Hanchrow wrote: > > 18:32:07 [erich AT slop erich]$ ssh alpha > > erich AT alpha's password: > > Last login: Mon Apr 7 13:23:14 2003 from slop.vhcorp.com > > Fanfare!!! > > You are successfully logged in to this server!!! > > > > 18:32:45 [erich AT alpha erich]$ net use \* \\\\10.10.89.89\\d$ /u:user "password" > > Drive J: is now connected to \\10.10.89.89\d$. > > > > The command completed successfully. > > > > 18:32:52 [erich AT alpha erich]$ > > >>>>> "Igor" == Igor Pechtchanski writes: > > Igor> You need to double them if you pass the "net use" command > Igor> through ssh. > > Could you explain that further? I've never needed to double them, as > you can see from the example. The only time that ssh requires me to > type anything differently is the tilde (and then only when it's > immediately preceded by a carriage-return, which is pretty rare) -- I > have to type it twice. > > Or did you mean something like this -- > > unix$ ssh windoze net use j: \\\\\\\\server\\\\host /u:user password Exactly. Any time you have another shell parse the input, you have to escape all the backslashes again (both the escapes and the real things). This will also require it: sh -c "net use j: \\\\\\\\server\\\\host /u:${user} ${password}" Of course, single quotes are the preferred way to deal with backslashes, but they don't get you variable expansion, e.g., as above. Hope this helps, Igor -- http://cs.nyu.edu/~pechtcha/ |\ _,,,---,,_ pechtcha AT cs DOT nyu DOT edu ZZZzz /,`.-'`' -. ;-;;,_ igor AT watson DOT ibm DOT com |,4- ) )-,_. ,\ ( `'-' Igor Pechtchanski '---''(_/--' `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-. Meow! Knowledge is an unending adventure at the edge of uncertainty. -- Leto II -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/ -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/