Windows drive mapping to FreeBSD directory fails with sshfs-win

Hello, I am trying to use sshfs-win to map a Windows drive to a remote directory hosted on a FreeBSD (14.1) server, but I am getting connection errors that I suspect are related to the FreeBSD configuration. The FreeBSD server is not remote at the moment: it is on a virtual machine hosted by the same Windows host I am trying to use sshfs-win on, with the Windows host's port 20022 forwarded to the FreeBSD server's port 22. Important note: the standard SSH connection done via ssh root@localhost -p 20022 works fine, the connection error only occurs with sshfs-win.

sshfs-win has two main entry points for doing the drive mapping: running sshfs-win.exe from the command line, or running the net use command (which uses sshfs-win.exe or sshfs.exe internally with certain ssh options passed). From the issues I have found searching in the web, it is common that if the mapping does not work with net use, it will still work with sshfs-win.exe. It does not work for me in either case.

For debugging, I put the FreeBSD sshd logs on VERBOSE so that I could see more detailed logs in the file /var/log/auth.log.

Trying to issue the command net use Z: \\sshfs.r\root@localhost!20022\home
It asks me to enter my username again and my password, then outputs an error:
Code:
The password is invalid for \\sshfs.r\root@localhost!20022\home.

Enter the user name for 'sshfs.r': root
Enter the password for sshfs.r:
System error 67 has occurred.

The network name cannot be found.

And this is the log produced by sshd:
Code:
Jan 18 10:32:03 freebsdserver sshd[1406]: Connection from 10.0.2.2 port 49684 on 10.0.2.15 port 22
Jan 18 10:32:03 freebsdserver sshd[1406]: Postponed keyboard-interactive for root from 10.0.2.2 port 49684 ssh2 [preauth]
-- the following appears after net use command error (seems a timeout error)
Jan 18 10:33:03 freebsdserver sshd[1406]: error: PAM: Authentication error for root from 10.0.2.2
Jan 18 10:33:03 freebsdserver sshd[1406]: Failed keyboard-interactive/pam for root from 10.0.2.2 port 49684 ssh2
Jan 18 10:33:03 freebsdserver sshd[1406]: Failed none for root from 10.0.2.2 port 49684 ssh2
Jan 18 10:33:03 freebsdserver sshd[1406]: Connection closed by authenticating user root 10.0.2.2 port 49684 [preauth]

Trying to issue the command ./sshfs-win.exe svc \sshfs.r\root@localhost!20022\home Z:
I enter the password (waiting for stdin), then outputs an error
Code:
123456 -- password of the server
Timeout waiting for prompt
KO

And this is the log produced by sshd:
Code:
Jan 18 10:42:05 freebsdserver sshd[4938]: Connection from 10.0.2.2 port 49707 on 10.0.2.15 port 22
Jan 18 10:42:05 freebsdserver sshd[4938]: Postponed keyboard-interactive for root from 10.0.2.2 port 49707 ssh2 [preauth]
Jan 18 10:43:05 freebsdserver sshd[4938]: error: PAM: Authentication error for root from 10.0.2.2
Jan 18 10:43:05 freebsdserver sshd[4938]: Failed keyboard-interactive/pam for root from 10.0.2.2 port 49707 ssh2
Jan 18 10:43:05 freebsdserver sshd[4938]: Failed none for root from 10.0.2.2 port 49707 ssh2
Jan 18 10:43:05 freebsdserver sshd[4938]: Connection closed by authenticating user root 10.0.2.2 port 49707 [preauth]

The actual error log produced by sshd is (the rest is part of the verbose log):
Code:
freebsdserver sshd[1406]: error: PAM: Authentication error for root from 10.0.2.2
freebsdserver sshd[1406]: Failed keyboard-interactive/pam for root from 10.0.2.2 port 49684 ssh2

As indicated at the beginning, a connection using the ssh command works correctly, producing the following logs from sshd:
Code:
Jan 18 10:50:15 freebsdserver sshd[7515]: Connection from 10.0.2.2 port 49723 on 10.0.2.15 port 22
Jan 18 10:50:15 freebsdserver sshd[7515]: Postponed keyboard-interactive for root from 10.0.2.2 port 49723 ssh2 [preauth]
-- after inserting password
Jan 18 10:50:17 freebsdserver sshd[7515]: Postponed keyboard-interactive/pam for root from 10.0.2.2 port 49723 ssh2 [preauth]
Jan 18 10:50:17 freebsdserver sshd[7515]: Accepted keyboard-interactive/pam for root from 10.0.2.2 port 49723 ssh2
Jan 18 10:50:17 freebsdserver sshd[7515]: Starting session: shell on pts/1 for root from 10.0.2.2 port 49723 id 0

I am not sure if this is a problem with my Windows host or with FreeBSD. Would it help if I try to install a Linux distribution and see if it works?

Thanks.

Update: I tried installing Debian in a VM, and using the same commands, it worked fine. So we can rule out that the problem is not with the Windows host, and as I suspected, it is with FreeBSD. The FreeBSD installation is pretty fresh, I didn't change anything except the ssh options for PermitRootLogin. Any ideas?
 
Update: I tried installing Debian in a VM, and using the same commands, it worked fine. So we can rule out that the problem is not with the Windows host, and as I suspected, it is with FreeBSD. The FreeBSD installation is pretty fresh, I didn't change anything except the ssh options for PermitRootLogin. Any ideas?
 
Update 2: I narrowed down the problem by setting UsePam to no in /etc/ssh/sshd_config, which made sshfs-win work. This is obviously a temporary solution, which I will try to fix by changing the default /etc/pam.d/sshd. Does anyone have any idea what the problem is with PAM? I don't know much about PAM, so I don't know where to start.
 
Back
Top