X-Spam-Check-By: sourceware.org Date: Fri, 30 Jun 2006 11:38:31 +0200 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: Access to Network Drive under ssh Message-ID: <20060630093831.GM18873@calimero.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <200606300846 DOT k5U8kpg8007217 AT sd DOT skydive1 DOT com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200606300846.k5U8kpg8007217@sd.skydive1.com> User-Agent: Mutt/1.4.2i 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 Jun 29 22:46, Richard Foulk wrote: > I've written my own mount command for Cygwin in Perl. One thing to > be aware of is that drive letters aren't necessary with Cygwin. > > You can't say: `cd \\xyz\c$' with Windows cmd.exe. > > You *can* say things like: `cd //xyz/c\$' in Cygwin. This cleans up > many things. If you have the right permissions `net use' isn't necessary! > > A wrapper for `net use' in Perl is pretty easy to do, including all > the password stuff. > > Those drive letters just get in the way. Don't use them. To add another data point: When running under a public key ssh session, you're running in the login session of the SYSTEM user. Also, since you used pubkey instead of password login, you don't have the credentials for network access. This has two results: - You must use the net command to connect to non-public shares. - You must use username and password in the net use command. - You can't use drive letters. So, what you have to do is this: Use the 'net use' command with full qualified domain/user name and password, omitting the drive letter, FROM INSIDE YOUR PUBKEY SSH SESSION. This is essential. You only have to do this once, in your first ssh session, the connection to the shares is persistent across multiple sessions as long as you don't reboot. $ net use \\\\server\\share /user:DOMAIN\\username password If you don't have a domain, use the name of your local windows box instead. However, YMMV depending on the security level used on the server you're connecting to. Now you can cd to the share as outlined above: $ cd //server/share In my local environment, I have a tiny script to connect to the servers. I start it manually after a (re)boot FROM INSIDE MY PUBKEY SSH SESSION. Additionally I have the matching mount points always defined to access the shares like local directories: $ cat ~/bin/calimero #!/bin/bash SERVER='\\calimero' SHARES='cygwinsrc cygwinbin' USER='CATHI\corinna' pwd=$1 [ -z "$pwd" ] && read -sp "Password: " pwd && echo [ -z "$pwd" ] && exit 1 for i in $SHARES do net use "$SERVER\\$i" /user:"$USER" $pwd done $ mount | grep calimero \\calimero\cygwinbin on /home/corinna/bin/cygwin type system (binmode) \\calimero\cygwinsrc on /home/corinna/src/cygwin type system (binmode) This way I can just manually reconnect to the server after booting and then use the shares like local dirs: $ cd ~/src/cygwin/src/winsup $ df . Filesystem 1K-blocks Used Available Use% Mounted on \\calimero\cygwinsrc 66168952 38452912 27716040 59% /home/corinna/src/cygwin Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Project Co-Leader cygwin AT cygwin DOT com Red Hat -- 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/