# netmount sshfs

## logistiker

Does anyone know if it's possible for netmount on openrc to automount password less sshfs mounts?  

/etc/fstab example:

sshfs#user@host:/home/foo/bar        /home/foo/bar        fuse    fsname=sshfs#user@host:/home/foo/bar,comment=sshfs,users,exec,uid=1000,gid=100,allow_other,reconnect,transform_symlinks,BatchMode=yes 0 0

I can mount this inside the user account but I can't mount it from root.  I assume netmount runs as root as well and cannot mount this.  This is the error I get when attempting to mount from root:

read: Connection reset by peer

----------

## erik258

I don't mean to be lame (I just cant help it) but can you please post relevant lines from fstab inside code tags?  When it all runs together it's difficult to see what you're up to.  

Since I've had a passing interest in sshfs for some time, I decided to install and play around.  

The other thing I'm wondering is this: are you using an SSH key to connect?  Because if you are, I'd imagine sshfs would be pulling it from ~/.ssh/id_rsa, which wouldn't be the same for root.  But you'll have to bear with me while I familiarize myself with this sshfs thing...

----------

## logistiker

Ok I figured it out

In /etc/fstab:

```
sshfs#user@host:/home/foo/bar /home/foo/bar fuse fsname=sshfs#user@host:/home/foo/bar,comment=sshfs,users,exec,uid=1000,gid=100,allow_other,reconnect,transform_symlinks,BatchMode=yes 0 0
```

In /root/.ssh:

Add your private key or keys for the machines you want to log into 

And finally as the root user, log into those machines using the user for that machine (not necessarily root) so that the machine gets appended to the /root/.ssh/known_hosts file.

Then voila!  netmount will mount sshfs.

----------

## logistiker

 *erik258 wrote:*   

> Because if you are, I'd imagine sshfs would be pulling it from ~/.ssh/id_rsa, which wouldn't be the same for root.

 

Thanks for the hint.   :Smile: 

----------

## erik258

Woot. 

hey, this sshfs stuff is awesome!   A bit slow, but that's to be expected.  Totally awesome.  No longer must I fiddle with scp commands to access a bunch of files over ssh, and that makes me happy.  so thanks for spurring me to investigate.

----------

