SSHFS

Hello! Long time away :)

I am trying to mount a directory from a linux retropie system in my freebsd laptop with sshfs, but I am really confused since something strange it's happening:

Remote: (linux)
- user = myself (uid = 1003, main group is myself with gid=1003)
- folder = /folder/on/remote/machine, owned by user myself, and gid = 1004 (user myself also belongs to this group)

local: (freebsd)
- user = myself (uid = 1001, main gid = 1001, also belongs to operator group, since I read that was important)
- mount point = /folder/on/local/machine, owned by user myself, and gid = 1001

When user myself tries to mount with the following command, it mounts, but it can't access the mount point (error is "ls: Operation not permitted"):
doas /usr/local/bin/sshfs myself@192.168.1.100:/folder/on/remote/machine /folder/on/local/machine -o reconnect
But root on local machine is able to cd to the mounted dir and see its contents.

I though that could be related to uid and gid, so I used the following command to mount:
doas /usr/local/bin/sshfs myself@192.168.1.100:/folder/on/remote/machine /folder/on/local/machine -o idmap=file,uidfile=uid_txt,gidfile=gid_txt,reconnect
The uid_txt file has: username:1003
The gid_txt file has: groupname:1004
which are the ids of the remote machine's myself user and folder group (that myself also belongs to)

This way, after asking for password, does not show any error, but does not mount.

???

Thank you!
 
Do you have:
Code:
[gunsynd.331] $ sysctl -a | grep vfs.usermount
vfs.usermount: 1
And don't forget sudo kldload fusefs

Edit: testing may leave some ssh/sshd processes hanging around on client/server. Best to clean these up before testing afresh.
 
Thank you for you reply.

Added vfs.usermount=1 to /etc/sysctl.conf
Then to avoid reboot:
sysctl vfs.usermount=1

$ kldstat | grep fuse
15 1 0xffffffff83515000 11cd8 fusefs.ko
$ sysctl -a | grep vfs.usermount
vfs.usermount: 1

So it seams as you said. But the situation is the same. With the command:

doas /usr/local/bin/sshfs myself@192.168.1.100:/folder/on/remote/machine /folder/on/local/machine -o idmap=file,uidfile=uid_txt,gidfile=gid_txt,reconnect

asks for password, does not displays any error after that and does not mount.
 
Hi balanga... it seams really a good tool... but I am not being able to make it work as it should...
Really hoping for some hints of experienced freebsd users :)
 
Hi balanga... it seams really a good tool... but I am not being able to make it work as it should...
Really hoping for some hints of experienced freebsd users :)
I hadn't used it previously but all I needed to do was:-

sshfs 192.168.1.14:/ /mnt/test

where 192.168.1.14 is running sshd.
 
Well... I works now!! :)

Just simplified the things after gpw928 post... So just did it without doas and without any option:
sshfs 192.168.1.100:/folder/on/remote/machine /folder/on/local/machine

It mounts, user has rw access. The funny thing i that root on local machine is not allowed not even to ls to the mounted dir :-)
Does not seams a problem to me, but its strange...
 
I hadn't used it previously but all I needed to do was:-

sshfs 192.168.1.14:/ /mnt/test

where 192.168.1.14 is running sshd.
yep... it seams that because I did not have initially the usermount=1 took me to all the mess above :-)

Thank you also for your confirmation.
 
It mounts, user has rw access. The funny thing i that root on local machine is not allowed not even to ls to the mounted dir :)
Does not seams a problem to me, but its strange...
That does not surprise me. sshfs(1) says "By default, only the mounting user will be able to access the filesystem" (and root on the client does not equate to root on the server).
 
For this, I am transferring files between a raspberry (with linux) and a freebsd laptop through wireless connection. The wireless performance in my freebsd iaptop is not great. I have a max of 2,5MB/s and I can live with that. If necessary I put the cable on...
In this situation by transferring with sshfs, I am having maximum of 400kB/s. I am not complaining because it is slow or not... I am just curious about what would be the expected speed value according this scenario and if is there any possibility to increase the speed ?
 
For this, I am transferring files between a raspberry (with linux) and a freebsd laptop through wireless connection. The wireless performance in my freebsd iaptop is not great. I have a max of 2,5MB/s and I can live with that. If necessary I put the cable on...
In this situation by transferring with sshfs, I am having maximum of 400kB/s. I am not complaining because it is slow or not... I am just curious about what would be the expected speed value according this scenario and if is there any possibility to increase the speed ?
I never used sshfs but I have used ssh pipes through WAN obtaining the maximum speed of one of the nodes with a latency of 11ms about 32MB/s, telling me that it has about 400KB/s locally is not acceptable.

Before reviewing your sshfs configuration further, could you try doing a transfer via scp, or ssh with a pipe or with nc?
 
There's a lot of different overheads to consider.

Encryption by ssh definitely has a cost. And the CPU you use will usually limit the throughput. You can change the cipher to one of the faster ones (Google: ssh fastest cipher). [ssh used to support "-c none", and I have been known to rail about its removal.]

There's also the underlying transport. With the ssh mount on a Ubuntu server (Intel Core i7-3770K CPU @ 3.50GHz) running over gigabit Ethernet to a Debian KVM server (Pentium Silver N6005 @ 2.00GHz CPU), and then through a software bridge to a FreeBSD VM client, I can sustain writing at 10 MiB/sec using the chacha20-poly1305 cipher.
 
There's a lot of different overheads to consider.

Encryption by ssh definitely has a cost. And the CPU you use will usually limit the throughput. You can change the cipher to one of the faster ones (Google: ssh fastest cipher). [ssh used to support "-c none", and I have been known to rail about its removal.]

There's also the underlying transport. With the ssh mount on a Ubuntu server (Intel Core i7-3770K CPU @ 3.50GHz) running over gigabit Ethernet to a Debian KVM server (Pentium Silver N6005 @ 2.00GHz CPU), and then through a software bridge to a FreeBSD VM client, I can sustain writing at 10 MiB/sec using the chacha20-poly1305 cipher.
Good point, I just saw that one of the clients is running on a raspberry, surely the CPU does not have cryptographic instructions like AES-NI to be able to speed up the operations, perhaps that is a potential bottleneck
 
I never used sshfs but I have used ssh pipes through WAN obtaining the maximum speed of one of the nodes with a latency of 11ms about 32MB/s, telling me that it has about 400KB/s locally is not acceptable.

Before reviewing your sshfs configuration further, could you try doing a transfer via scp, or ssh with a pipe or with nc?

With scp the speed is the same... arround 400kB/s. Maybe I could do something in the sshfs configuration to help a little...

I was trying to config the raspberry to have a shared disk at home always available to everyone. I started with nfs and I could do it until the point I got stuck due to the fact that I was not able to have the right access because the uid of the username of freebsd client is not the same of the same username on the nfs server (raspberry). I am still trying to understand how can I solve that...
Changing to sshfs solve me this issue, but the speed is really bad on my configuration.
 
Well... I just transferred a file with nfs and the speed increased to 450kB/s... :|
I dont know what to think... but it a little bit sad to have only this transfer speed... I need to do some more tests... maybe connect the raspberry to cable and check again
 
I started with nfs and I could do it until the point I got stuck due to the fact that I was not able to have the right access because the uid of the username of freebsd client is not the same of the same username on the nfs server (raspberry). I am still trying to understand how can I solve that...
You are not the first person in the world facing such an issue. The traditional and fairly easy approach is using NIS for that. This is essentially sharing a pair of global passwd(5)/group(5) files (usually excluding system users/groups like root).​
Changing to sshfs solve me this issue, but the speed is really bad on my configuration.
“Here’s Johnny!” ? Use the right tool for the job: sshfs(1) is neat for ad-hoc mounts by unprivileged users.​
$ kldstat | grep fuse
15 1 0xffffffff83515000 11cd8 fusefs.ko
$ sysctl -a | grep vfs.usermount
vfs.usermount: 1
As an aside, this is a bit of a bad habit I once had too. ? The tools do provide means to get just the data you want. No grep(1) needed. ?​
Bash:
kldstat -m fusefs
sysctl vfs.usermount
 
You are not the first person in the world facing such an issue. The traditional and fairly easy approach is using NIS for that. This is essentially sharing a pair of global passwd(5)/group(5) files (usually excluding system users/groups like root).

“Here’s Johnny!” ? Use the right tool for the job: sshfs(1) is neat for ad-hoc mounts by unprivileged users.

As an aside, this is a bit of a bad habit I once had too. ? The tools do provide means to get just the data you want. No grep(1) needed. ?​
Bash:
kldstat -m fusefs
sysctl vfs.usermount
Thank you for your comments.

In this particular case, since nfs and sshfs are having the same speed I just can think on two reasons:
- One of the machines is a raspberry
- wifi on my freebsd laptop never was able to go above 3MB/s

I have no idea if there is a solution for wifi performance. For the raspberry... maybe I have to get V4 instead playing with older V3B.
 
I started with nfs and I could do it until the point I got stuck due to the fact that I was not able to have the right access because the uid of the username of freebsd client is not the same of the same username on the nfs server (raspberry). I am still trying to understand how can I solve that...
NFSV4 provides mappings.
 
Back
Top