Can only run sshfs as root

Harry Stone

Member

Thanks: 1
Messages: 20

#1
Is there anything special I need to do to run sshfs as a regular user? I saw another thread here from a while back that says I need vfs.usermount set to 1, which I do, but still no luck. It works fine when run as root but otherwise I get "operation not permitted."

I can make this work by adding setuid permissions to /sbin/mount_fusefs. But is that the only way?

thanks!
 
Last edited by a moderator:

Oko

Daemon

Thanks: 763
Messages: 1,620

#2
I have never used sshfs on FreeBSD but on OpenBSD user mount option was removed about a year ago. I don't recall the reason but you can probably find out on tech@openbsd. You have to be root to mount the file system.

https://marc.info/?l=openbsd-misc&m=149805347118472&w=2

Have you read man pages for sshfs for your version of FreeBSD. I would not rely on any Internet archive and I would be very worried about getting outdated information even from the official FreeBSD handbook. That thing is really hit and miss and it is not properly updated.
 

SirDice

Administrator
Staff member
Administrator
Moderator

Thanks: 6,334
Messages: 27,504

#3
I saw another thread here from a while back that says I need vfs.usermount set to 1, which I do, but still no luck.
This setting allows a user to mount filesystems. But there's another requirement, the user must also be the owner of the mountpoint.
 

Nicola Mingotti

Well-Known Member

Thanks: 118
Messages: 297

#7
To me it works, I spent a lot of time to have it working well, it is very important IMO.
The following procedure is valid for FreeBSD-11.1.

Here is what is written into my notes: ( my user in FreeBSD is "p")
Code:
root@fbs> pkg install fusefs-sshfs-3.3.0
root@fbs> sysctl vfs.usermount=1
root@fbs> pw groupmod operator -m p
Then I mount a handfull of remote directories as user "p"
in FreeBSD, like in the next step. In this case I mount an OSX directory
/Users/Nicola/Downloads owned by "nicola" there, into the local dir /home/p/osx
owned by "p" in FreeBSD.
Code:
p@fbs> OPT='-o idmap=user -o ServerAliveInterval=15 -o reconnect'
p@fbs> sshfs $OPT nicola@172.16.0.1:/Users/Nicola/Downloads /home/p/osx
CAVEAT. Be carefull, the above is ok for testing, but use fusefs-sshfs from ports to have release >= 3.3.1, there is an ugly bug in the package version 3.3.0. I have opened a thread about this a short time ago;)
https://forums.freebsd.org/threads/...sk-from-gui-gives-disk-full.64354/post-374330
 

Nicola Mingotti

Well-Known Member

Thanks: 118
Messages: 297

#9
You mistook something or the man page is wrong.
It think the first option is far more probable.

Tha man page for sshfs states
Code:
It is recommended to run SSHFS as regular user (not as root).  For this
to work the mountpoint must be owned by the user.
1] (root) I made a user "test"
2] (root) I added user "test" to group "operator"
3] I logged in as user "test"
3.1] I checked to be in group "operator" groups
3.2] I checked to be into "test" home directory
4] I made a directory "mnt" in user "test" home
5] Then I did
Code:
test@localhost> sshfs  foo@bar.baz:/home/foo ~/mnt/
=> It works

I got the same error you are talking about in two cases:
1] I don't add user "test" to group "operator"
2] I don't monut sshfs to a directory owned by "test"

Hope you can make it, sshfs for me it is fundamental so I undestand your position.
 
Top