This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: Access to Network Drive under ssh
- From: Corinna Vinschen <corinna-cygwin at cygwin dot com>
- To: cygwin at cygwin dot com
- Date: Fri, 30 Jun 2006 11:38:31 +0200
- Subject: Re: Access to Network Drive under ssh
- References: <200606300846.k5U8kpg8007217@sd.skydive1.com>
- Reply-to: 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/