# sshfs user Permission Denied



## andyzammy (Jul 8, 2011)

Hi!

I'm trying to sshfs on to a linux box. Have installed sshfs from ports. Super User manages this fine, but I can't get in to the mount point as normal user (denied):


```
$ ls -al /usr/local/bin/sshfs
-r-xr-xr-x  1 root  wheel  49584 Jul  8 20:59 /usr/local/bin/sshfs
```

The normal user is part of the wheel so I would have thought that it has same access level as root does.. but when I look at the file properties of the mount point when root uses sshfs on it:


```
Owner: 1000 - user #1000
Group: 1000
```

I try to add myself to that group but it doesn't exist. Please could someone tell me how to make sshfs usable to non super users please?


----------



## wblock@ (Jul 8, 2011)

Make the normal user the owner of the mount point.


----------



## andyzammy (Jul 9, 2011)

wblock said:
			
		

> Make the normal user the owner of the mount point.



Thanks for your reply!

I did, normal created it. If it makes any difference, it was in my home directory: /home/usr/mnt


----------



## wblock@ (Jul 9, 2011)

Does /etc/sysctl.conf contain

```
vfs.usermount=1
```


----------



## andyzammy (Jul 9, 2011)

wblock said:
			
		

> Does /etc/sysctl.conf contain
> 
> ```
> vfs.usermount=1
> ```



No it doesn't, it's empty.


----------



## wblock@ (Jul 9, 2011)

Actually, I don't know if that applies to sshfs, but see the FAQ about letting normal users mount media.


----------



## andyzammy (Jul 9, 2011)

wblock said:
			
		

> Actually, I don't know if that applies to sshfs, but see the FAQ about letting normal users mount media.



I tried this, but I'm not sure that I'm applying the tutorial correctly to mounting for sshfs. Do I *chgrp* to wheel? And do I *chmod* to 666 or 640? After applying *chgrp* I couldn't *ls* the directory as the normal user (denied).


----------



## mix_room (Jul 11, 2011)

Does the user have read access to the remote filesystem? 
Who does the mounting? 
When does it fail? 
How does it fail? - What is the error message. 
What command are you using to mount the remote filesystem? 

I just installed fusefs-sshfs to check, and I have no problems. 

My local-user can mount the remote filesystem, as can root.

The stuff posted by wblock does not need to be applied. The only thing that I needed to change was `# sysctl vfs.usermount =1`


----------



## wblock@ (Jul 11, 2011)

mix_room said:
			
		

> The stuff posted by wblock does not need to be applied. The only thing that I needed to change was `# sysctl vfs.usermount =1`



That was what I posted.  Or are you saying the mount point doesn't need to be owned by the user for sshfs?


----------



## wblock@ (Jul 11, 2011)

andyzammy said:
			
		

> I tried this, but I'm not sure that I'm applying the tutorial correctly to mounting for sshfs. Do I *chgrp* to wheel? And do I *chmod* to 666 or 640? After applying *chgrp* I couldn't *ls* the directory as the normal user (denied).



The permission changes are only needed if you're trying to mount a device in /dev that the user doesn't normally have permission to.  That's not the case here.


```
% id -p
uid	wblock
groups	wheel operator
% sysctl vfs.usermount
vfs.usermount: 1
% mkdir sshmount
% sshfs wblock@othersystem:/tmp sshmount
```

Tested here.


----------



## andyzammy (Jul 11, 2011)

mix_room said:
			
		

> Does the user have read access to the remote filesystem?
> Who does the mounting?
> When does it fail?
> How does it fail? - What is the error message.
> ...



user tries to mount

fails after I give the password:


```
sshfs user@desktop:/home/user /home/usr/mnt
user@desktop.home's password:
fuse: failed to open fuse device: Permission denied
```


```
sysctl vfs.usermount
vfs.usermount: 0
```
I tried sshfs after the sysctl command you gave and it said:


```
Directory stack not that deep.
```


----------



## wblock@ (Jul 11, 2011)

andyzammy said:
			
		

> ```
> sshfs user@desktop:/home/user /home/usr/mnt
> user@desktop.home's password:
> fuse: failed to open fuse device: Permission denied
> ```



/dev/fuse0 has an owner of operator.  Is the user a member of the operator group?



> I tried sshfs after the sysctl command you gave and it said:
> 
> 
> ```
> ...



No idea on that, but it's closer.  "desktop" is a different computer than the one doing the sshfs, right?


----------



## andyzammy (Jul 12, 2011)

wblock said:
			
		

> /dev/fuse0 has an owner of operator.  Is the user a member of the operator group?
> 
> 
> 
> No idea on that, but it's closer.  "desktop" is a different computer than the one doing the sshfs, right?



Ah, okay, so I added user to operator group, now I'm getting a different message:


```
mount_fusefs: /dev/fuse0 on /usr/home/user/mnt: Operation not permitted
fuse: failed to mount file system: No such file or directory
```

Yes, desktop is my linux box, trying to sshfs in from my laptop. Is it the ext4 FS that it's complaining about now? Or does it have something to do with vfs.usermount?


----------



## wblock@ (Jul 12, 2011)

Yes, vfs.usermount=1 is needed.  That's why you got "operation not permitted".  Put it in /etc/sysctl.conf.

The actual filesystem on the target doesn't matter at all.  You're connecting through ssh, and letting the target system handle all the actual filesystem access.


----------



## mix_room (Jul 12, 2011)

wblock said:
			
		

> That was what I posted.  Or are you saying the mount point doesn't need to be owned by the user for sshfs?



Sorry for not being clear. I was refering to all the stuff about changing permissions on block devices and the rest of the information in your link. 

andy: run `# sysctl vfs.usermount = 1` and then try again. You NEED to set the variable. What you ran just queries the variable.


----------



## andyzammy (Jul 13, 2011)

mix_room said:
			
		

> Sorry for not being clear. I was refering to all the stuff about changing permissions on block devices and the rest of the information in your link.
> 
> andy: run `# sysctl vfs.usermount = 1` and then try again. You NEED to set the variable. What you ran just queries the variable.



I did run the "=1" cmd and it did give "Directory stack not that deep." back to me. However, running it now gives:


```
vfs.usermount: 0
sysctl: unknown oid ''
```


----------



## mix_room (Jul 13, 2011)

try without the spaces.


----------



## andyzammy (Jul 14, 2011)

mix_room said:
			
		

> try without the spaces.



that did it, thank you!


----------



## freq (Sep 15, 2019)

After updating sysctl.conf, does anything need to be restarted? I am still getting "failed to open fuse device - no such file or dir".


----------



## tingo (Sep 21, 2019)

Values in /etc/sysctl.conf are read and acted upon at boot. However, if you have also executed `# sysctl vfs.usermount=1`, you should be good to go, as this sets the variable immediately.
Your error message "no such file or dir" indicates a different problem. Have you looked carefully at the paths your are trying to mount (both to and from)? If either of those don't exist, you will end up with an error.


----------

