Saturday, February 14, 2009

Windows Mounted Drives in an SSH Session

SSH is a great tool because it gives you remote shells on your hosts, allows you to copy files between hosts, creates tunnels for you via port forwarding, forwards your X connection, and the list goes on... Usually, SSH is taken advantage of on Linux and/or other Unix systems. But it can be run on Windows systems too, using the SSH server that comes with Cygwin.

The problem I had was that when I logged in to my Windows machine with SSH, my mounted drives were all missing!

When you set up SSH with Cygwin, you create a service to run the server. This causes the server to run as the SYSTEM user by default.

When you ssh to your Windows machine running cygwin's sshd, network mounts on that machine are not available to you. This is basically because you are not really running the shell as you, but rather as the SYSTEM user acting as you.

There are two options for dealing with this if you need to have your mounted drives.

Option 1 - run sshd as you

This would solve any permissions problems, including those that cause the missing network drives. The only problem with this is that it won't work for any other users. But on Windows, that's often not an issue.

Option 2 - use the 'screen' program

If you are lucky enough to have discovered 'screen', you probably use it all the time. The idea is that if you have a screen session running, you can attach to that screen session from your ssh client shell. That shell will be running as if you were sitting there, meaning all network mounts will be available.

The only caveat is: you won't be able to start any X client applications, even with ssh -X or ssh -Y.

No comments: