# [ SOLVED ] sshfs public key auth

## mbjr

Hi there,

I've been working on to get an sshfs mount together however I keep failing when I use protocol1 and pubkey auth.

I do it thisway:

sshfs isme@something.homelinux.org:/ /mnt/bibTest/ -o Port=40022 -o Protocol=1 -o IdentityFile=/home/isme/.ssh/identity

I get this on the client side:

remote host has disconnected

I get this on the server side: 

Oct 18 00:22:00 docsrv sshd[19608]: debug3: fd 4 is not O_NONBLOCK

Oct 18 00:22:00 docsrv sshd[19648]: debug1: rexec start in 4 out 4 newsock 4 pipe 6 sock 7

Oct 18 00:22:00 docsrv sshd[19608]: debug1: Forked child 19648.

Oct 18 00:22:00 docsrv sshd[19608]: debug3: send_rexec_state: entering fd = 7 config len 942

Oct 18 00:22:00 docsrv sshd[19608]: debug3: ssh_msg_send: type 0

Oct 18 00:22:00 docsrv sshd[19608]: debug3: send_rexec_state: done

Oct 18 00:22:00 docsrv sshd[19648]: debug1: inetd sockets after dupping: 3, 3

Oct 18 00:22:00 docsrv sshd[19648]: Connection from 217.27.216.86 port 58110

Oct 18 00:22:00 docsrv sshd[19648]: Did not receive identification string from 217.27.216.86

Allthough, when I try the same using ssh, I can login with no problem:

ssh something.homelinux.org -l isme -p 40022 -1 -i /home/isme/.ssh/identity

If I use no public key auth, I can mount the stuff with no problem. :-/

As Miklos says on his homepage: This is a filesystem client based on the SSH File Transfer Protocol.

So I started to figure if there's any problem going on with sftp connections, but nope, I can connect with any graphical client using the same exact key and options (v1 and special port).

Anyone experiencing (and probably solving) such thigs before?

Thanks,

----------

## mbjr

Hi all,

replying to my own post again  :Smile:  ah...

So I'd like to let you know that the issue above is a bug within sshfs, and there's a workaround availabe (thanks goes to Miklos Szeredi @ sshfs) to make it work.

The problem is with the ssh strict v1.

The workaround is a script below (sftp-server path should be changed to fit your configuration):

```
#! /bin/bash

shift 

x=("$@")

unset x[$(($# - 1))]

unset x[$(($# - 2))]

exec ssh -1 "${x[@]}" /usr/lib/sftp-server
```

and then use ~/sshfs/sshfs -ossh_command=path_to_script user@host:/ /mountpoint

and that'll make it work  :Smile: 

Cheers,

----------

## Guglie

 *mbjr wrote:*   

> So I'd like to let you know that the issue above is a bug within sshfs, and there's a workaround availabe (thanks goes to Miklos Szeredi @ sshfs) to make it work.

 

Ok, the patch forks, but why does not the developers of sshfs fix the bug in the sshfs code? I can't even find an opened bug about this in the USL bugzilla

----------

## Guglie

 *Guglie wrote:*   

> Ok, the patch forks

 

No, the patch doesn't work but doesn't even output in the shell or in the logs any error

```
evellon@galvorn $ sshfs  ospite@localhost: /home/evellon/mnt -o IdentifyFile=/home/evellon/.ssh/id_backup

remote host has disconnected

evellon@galvorn $ cat ./sshfs_publickey_patch.sh

#!/bin/bash

# (c) Miklos Szeredi @ sshfs

shift

x=("$@")

unset x[$(($# - 1))]

unset x[$(($# - 2))]

exec ssh -1 "${x[@]}" /usr/lib/misc/sftp-server

evellon@galvorn $ sshfs -ossh_command=./sshfs_publickey_patch.sh ospite@localhost: /home/evellon/mnt -o IdentifyFile=/home/evellon/.ssh/id_backup

evellon@galvorn $ echo $?

141

evellon@galvorn $ mount

/dev/hda5 on / type xfs (rw,noatime)

proc on /proc type proc (rw)

sysfs on /sys type sysfs (rw)

udev on /dev type tmpfs (rw,nosuid)

devpts on /dev/pts type devpts (rw)

/dev/hda7 on /home type xfs (rw,nosuid,nodev,noatime)

/dev/hda8 on /var/cache/edb/dep type reiserfs (rw,noatime)

/dev/hda9 on /usr/portage type reiserfs (rw,noatime)

none on /dev/shm type tmpfs (rw)

usbfs on /proc/bus/usb type usbfs (rw,devmode=0664,devgid=85)
```

----------

