# sshd/sshfs on windows host

## ksool

Has any body tried this? I was looking to this as a secure replacement for samba, but I'm not totally sure it'll work and I'm not sure how much overhead cygwin will have, and I need to be able to access files outside of the cygwin folder (I forget if cygwin locks you into its own directory).

Adivce?

----------

## Dlareh

It works great.  You can mount files outside of Cygwin's folder: drives are accessed as /cygdrive/c, /cygdrive/d, etc, but you can make symlinks from elsewhere if you want.

----------

## ksool

Ahh, awesome, openssh setup was really easy actually and sshfs worked out of the box.

Having some trouble with fstab though. Getting a "remote host has disconnected" when I try to mount it.

Any ideas?

----------

## ksool

Actually, not so awesome, it turns out. It stopped working!!!

I'm not sure where the problem is exactly, but I'm pretty sure that I have more than one problem:

1. From my machine, to try and sshfs to any system, it seems to mount ok, but when i do ls mnt_point, i get ls: No such file or directory.

This happens for every host I try, or I get a "remote host disconnected".

2. Still not working with fstab

3. Running openssh on windows only works when launched from the command line, and I can't get it to load at boot.

1 is obviously the most critical. Any help would be great, but I'm going to bed.

----------

## Dlareh

Hmm well I actually use shfs (one s).  E.g.:

```
mu ~ $ grep lsa2 /etc/fstab

dlareh@lsa2:/cygdrive                        /net/lsa2       shfs   noauto,user,stable       0 0

mu ~ $ mount /net/lsa2

dlareh@lsa2's password: 

mu ~ $ ls /net/lsa2

c
```

I've never had a problem getting openssh to run as a service on windows, and I've done it many times just following one of the first google results for "cygwin sshd".

----------

## ksool

Ah, weird, is shfs something different? I'm using fuse

Anyway, I'm trying to track this down by first getting it to work on a normal ssh server. This is one that I get "remote host has disconnected" from, and here's the log:

```

Oct 29 01:34:08 host sshd(pam_unix)[9750]: session opened for user user by (uid=0)

Oct 29 01:34:08 host sshd[9750]: subsystem request for sftp

Oct 29 01:34:08 host sshd[9750]: error: subsystem: cannot stat /usr/libexec/openssh/sftp-server: No such file or directory

Oct 29 01:34:08 host sshd[9750]: subsystem request for sftp failed, subsystem not found

Oct 29 01:34:08 host sshd(pam_unix)[9750]: session closed for user user

```

EDIT: fixed that, turns out the subsystem isn't located where default sshd_config says it should

I found it in /usr/lib/misc/sftp-server. So for not atleast, its working on linux machines.

(df doesn't work though, keeps saying I'm using 0% of 7.45 TB, but that's minor)Last edited by ksool on Sun Oct 29, 2006 6:54 am; edited 1 time in total

----------

## Dlareh

If you want to try shfs, it's

```
emerge shfs

modprobe shfs
```

----------

## ksool

I gave it a try, not sure how they're different really, but shfs seems to be working a bit better, thanks.

----------

## ksool

Correction for anybody who's looking to try this: don't use the sshwindows package (sshwindows.sourceforge.net). It's very light which is nice, but it ssh's you into the windows shell, which shfs doesnt like. It seems to work with sshfs but there are also other issues surrounding it, and it's no longer developed/supported. Cygwin is the better choice.

----------

## ksool

Just ran across another quick question. I'm having trouble with permissions.

When I ssh into cygwin, everything's fine, but doing it through shfs mount lets mt browse through my drives until a certain point, then gives me permission denied errors, even though I'm explicitly allowed there. Any ideas?

EDIT: It works fine for another host, so I'm guessing the problem is with cygwin?

FURTHER EDIT: It also works fine in the cygwin home directory.

doing a ls -l there shows that its Kevin:none, where as the directory I'm trying to get to is root:Users. I've also enabled ntea in cygwin which I think smooths out the differences between nt permissions and linux permissions. The nt permissions allow the users group to access this folder as well.

FINAL EDIT: Ended up chowning all the files to my ssh user, not a great solution but it works. Not sure why the group permissions don't work, (the whole thing was chmod'd to 0770).

----------

