# Can only run sshfs as root



## Harry Stone (Feb 19, 2018)

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!


----------



## Oko (Feb 19, 2018)

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 (Feb 19, 2018)

Harry Stone said:


> 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.


----------



## Harry Stone (Feb 21, 2018)

I own the mount point too.


----------



## tobik@ (Feb 21, 2018)

Does your user have read/write permissions to the /dev/fuse device?


----------



## Harry Stone (Feb 21, 2018)

/dev/fuse is like so:  

`$ ll fuse
crw-rw----  1 root  operator   0x6a Feb 21 13:12 fuse`

and I'm in group operator.


----------



## Nicola Mingotti (Feb 21, 2018)

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")

```
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.

```
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


----------



## Harry Stone (Feb 23, 2018)

Still no go unless mount_fusefs is setuid.  I guess that's the only solution.


----------



## Nicola Mingotti (Feb 24, 2018)

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

Tha man page for sshfs states

```
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

```
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.


----------

