sshfs failure - remote host has disconnected

The ssh server (FreeBSD 14.2) used to work nicely, but I don't know since when I can't mount its share from a FreeBSD workstation via sshfs, for example sudo sshfs -o allow_other,default_permissions bxbzq@192.168.1.151:/dir/to/video/ ~/video. The wierd thing is , to this ssh server, I can login via ssh, I can do sshfs from Windows, only that I cannot mount via sshfs as I used to do.
I suppose it is not pf causing the error, because I stop pf the issue persists.
 
You shouldn't need 'sudo' here if you are mounting inside your home directory, and given it has all sorts of opaque implications, it very well might be the culprit here...
Please show the full command an error message you are receiving.
 
You shouldn't need 'sudo' here if you are mounting inside your home directory, and given it has all sorts of opaque implications, it very well might be the culprit here...
Please show the full command an error message you are receiving.

Not much more to show, but here you go. As I mentioned, this command used to work.
Code:
dzs97p@AMD_STATION:~ % sshfs -o allow_other,default_permissions dzs97p@192.168.1.151:/backup/ent ~/video
mount_fusefs: /dev/fuse on /usr/home/dzs97p/video: Operation not permitted
dzs97p@AMD_STATION:~ % sudo sshfs -o allow_other,default_permissions dzs97p@192.168.1.151:/backup/ent ~/video
Password:
remote host has disconnected
On the ssh server, record in /var/log/auth.log says
Code:
May 20 22:12:40 BSD_DTP sshd[4044]: Connection closed by authenticating user dzs97p 192.168.1.160 port 24457 [preauth]
 
Is SFTP enabled on the SSH server? It is on by default, but maybe you turned it off?
Code:
       SSHFS allows you	to mount a remote  filesystem  using  SSH  (more  pre-
       cisely,	the  SFTP subsystem). Most SSH servers support and enable this
       SFTP access by default, so SSHFS	is very	simple to use -	there's	 noth-
       ing to do on the	server-side.
sshfs(1)

/etc/ssh/sshd_config:
Code:
# override default of no subsystems
Subsystem       sftp    /usr/libexec/sftp-server
sshd_config(5)
 
Yes, it is enabled.
Is SFTP enabled on the SSH server? It is on by default, but maybe you turned it off?
Code:
       SSHFS allows you    to mount a remote  filesystem  using  SSH  (more  pre-
       cisely,    the  SFTP subsystem). Most SSH servers support and enable this
       SFTP access by default, so SSHFS    is very    simple to use -    there's     noth-
       ing to do on the    server-side.
sshfs(1)

/etc/ssh/sshd_config:
Code:
# override default of no subsystems
Subsystem       sftp    /usr/libexec/sftp-server
sshd_config(5)
 
Try adding -d to the sshfs(1) command, perhaps that provides some additional clues.
Code:
       -d, --debug
	      print debugging information.
 
mount_fusefs: /dev/fuse on /usr/home/dzs97p/video: Operation not permitted

Is the fusefs kernel module loaded? kldstat | grep fuse
Are usermounts allowed? sysctl vfs.usermount
Does the user 'dzs97p' own the local mountpoint and has access rights to the remote directory?

You should also consider using key-based authentication, so you don't have to provide a password every time.
 
How do you authenticate ssh? Obviously if you are using an agent you need to make it available to the root user to make the commandline with sudo work.

Does `sudo ssh bxbzq@192.168.1.151 ls` work? Does it ask for a password?
 
Sorry for late response. Been away for a few days.
Is the fusefs kernel module loaded? kldstat | grep fuse
Yes.
Are usermounts allowed? sysctl vfs.usermount
Yes.
Does the user 'dzs97p' own the local mountpoint and has access rights to the remote directory?
Yes.
You should also consider using key-based authentication, so you don't have to provide a password every time.
The server IS using key-based authentication.

dzs97p@AMD_STATION:~ % sudo sshfs -d -o allow_other,default_permissions dzs97p@192.168.1.151:/backup/ent ~/video
Password:
SSHFS version 3.7.3
executing <ssh> <-x> <-a> <-oClearAllForwardings=yes> <-2> <dzs97p@192.168.1.151> <-s> <sftp>
dzs97p@192.168.1.151: Permission denied (publickey).
remote host has disconnected
dzs97p@AMD_STATION:~ %
dzs97p@AMD_STATION:~ %
dzs97p@AMD_STATION:~ % sshfs -d -o allow_other,default_permissions dzs97p@192.168.1.151:/backup/ent ~/video
SSHFS version 3.7.3
executing <ssh> <-x> <-a> <-oClearAllForwardings=yes> <-2> <dzs97p@192.168.1.151> <-s> <sftp>
mount_fusefs: /dev/fuse on /usr/home/dzs97p/video: Operation not permitted
Server version: 3
Extension: posix-rename@openssh.com <1>
Extension: statvfs@openssh.com <2>
Extension: fstatvfs@openssh.com <2>
Extension: hardlink@openssh.com <1>
Extension: fsync@openssh.com <1>
Extension: lsetstat@openssh.com <1>
Extension: limits@openssh.com <1>
Extension: expand-path@openssh.com <1>
Extension: copy-data <1>
Extension: home-directory <1>
Extension: users-groups-by-id@openssh.com <1>

^Cunmounting /usr/home/dzs97p/video failed: Invalid argument
sent: 0 messages, 0 bytes
received: 0 messages, 0 bytes
rtt min/max/avg: 0ms/0ms/0ms
num connect: 1
dzs97p@AMD_STATION:~ %
dzs97p@AMD_STATION:~ %
dzs97p@AMD_STATION:~ % sudo ssh dzs97p@192.168.1.151 ls
Password:
dzs97p@192.168.1.151: Permission denied (publickey).
 
I should add, /dev/fuse belongs to root : operator and has 0666 permission, and user dzs97p is in group operator.
 
How do you authenticate ssh? Obviously if you are using an agent you need to make it available to the root user to make the commandline with sudo work.

Does `sudo ssh bxbzq@192.168.1.151 ls` work? Does it ask for a password?

I didn't know if I use agent, so I specifically added private key, still no success.
dzs97p@AMD_STATION:~ % eval `ssh-agent`
Agent pid 16244
dzs97p@AMD_STATION:~ %
dzs97p@AMD_STATION:~ % cd .ssh/;la
./ ../ id_rsa known_hosts
dzs97p@AMD_STATION:~/.ssh % ssh-add id_rsa
Identity added: id_rsa (dzs97p@BSD_DTP)
dzs97p@AMD_STATION:~/.ssh % cd
dzs97p@AMD_STATION:~ %
dzs97p@AMD_STATION:~ % sshfs -d -o allow_other,default_permissions dzs97p@192.168.1.151:/backup/ent ~/video
SSHFS version 3.7.3
executing <ssh> <-x> <-a> <-oClearAllForwardings=yes> <-2> <dzs97p@192.168.1.151> <-s> <sftp>mount_fusefs: /dev/fuse on /usr/home/dzs97p/video: Operation not permitted
Server version: 3
Extension: posix-rename@openssh.com <1>
Extension: statvfs@openssh.com <2>
Extension: fstatvfs@openssh.com <2>
Extension: hardlink@openssh.com <1>
Extension: fsync@openssh.com <1>
Extension: lsetstat@openssh.com <1>
Extension: limits@openssh.com <1>
Extension: expand-path@openssh.com <1>
Extension: copy-data <1>
Extension: home-directory <1>
Extension: users-groups-by-id@openssh.com <1>


^Cunmounting /usr/home/dzs97p/video failed: Invalid argument
sent: 0 messages, 0 bytes
received: 0 messages, 0 bytes
rtt min/max/avg: 0ms/0ms/0ms
num connect: 1
dzs97p@AMD_STATION:~ %
dzs97p@AMD_STATION:~ %
dzs97p@AMD_STATION:~ % sudo ssh dzs97p@192.168.1.151 ls
Password:
dzs97p@192.168.1.151: Permission denied (publickey).
dzs97p@AMD_STATION:~ %
dzs97p@AMD_STATION:~ %
dzs97p@AMD_STATION:~ % sudo sshfs -d -o allow_other,default_permissions dzs97p@192.168.1.151:/backup/ent ~/video
Password:
SSHFS version 3.7.3
executing <ssh> <-x> <-a> <-oClearAllForwardings=yes> <-2> <dzs97p@192.168.1.151> <-s> <sftp>dzs97p@192.168.1.151: Permission denied (publickey).
remote host has disconnected
dzs97p@AMD_STATION:~ %
dzs97p@AMD_STATION:~ % sshfs -o IdentityFile=~/.ssh/id_rsa,allow_other,default_permissions dzs97p@192.168.1.151:/backup/ent ~/video
mount_fusefs: /dev/fuse on /usr/home/dzs97p/video: Operation not permitted
remote host has disconnected
unmounting /usr/home/dzs97p/video failed: Invalid argumentdzs97p@AMD_STATION:~ %
 
You need to make the login via agent work with the sudo.
Progress is made by copying ~/.ssh/id_rsa to /root/.ssh/. Now sudo ssh dzs97p@192.168.1.151 ls gives me correct output, and I can do
sudo sshfs -o allow_other,default_permissions dzs97p@192.168.1.151:/backup/ent ~/video.

Don't understand why I can't run sshfs as a non-root user, as the manpage recommends. Also not sure if this is the correct way to solve the problem.
 
Back
Top