## Fixing group permissions in sshfs via OSXfuse

One could mount SSHFS partitions on a Mac OS X system via OSXfuse and MacFusion to access remote files securely as if the files were stored locally. However, group permission seems to not be preserved (get a permission denied message). This post shows how one could fix it by using the -o defer_permissions options.

## Symlinks in samba and sshfs

When setting up sshfs mounts and Linux samba servers, one can make it so that symbolic links are followed (so they aren’t broken). For sshfs, add the follow_symlinks option. In /etc/fstab/, the entry would look something like

sshfs#USERNAME@SERVERNAME: /mnt/acer fuse fsname=sshfs#USERNAME@SERVERNAME:,comment=sshfs,noauto,users,exec,uid=1000,gid=1000,allow_other,reconnect,transform_symlinks,follow_symlinks,BatchMode=yes 0 0


For samba, add the following to either the [global] options or the individual location in /etc/samba/smb.conf:

follow symlinks = yes
unix extensions = no


Make sure samba is restarted and the sshfs mount point is re-mounted.

## sshfs doesn’t forward X + conflict with “ControlMaster auto”

I use sshfs to mount remote directories on my laptop to access files as if they are stored locally. I love it. I also use the ControlMaster feature of OpenSSH to reuse an existing ssh connection when opening new ssh connections to the same host.

The problem is that X11 Forwarding doesn’t work with sshfs, at least not yet (don’t think it will be updated since the last release was in 2008). This means that when the servers are mounted via sshfs, any subsequent ssh connection that issues -Y or -X will not have X11 forwarding. I discovered this by seeing some of these errors when I connect to remote servers even though I declared -Y -C:

 <pre class="src src-sh">$firefox  Error: no display specified$ xterm xterm Xt error: Can‘t open display: xterm: DISPLAY is not set -bash: -sb: command not found \$ chromium-browser

(chromium-browser:14763): Gtk-WARNING **: cannot open display:

I posted this and this before figuring out it was an sshfs and ControlMaster problem.

Turning on X forwarding in ~/.ssh/config and /etc/ssh/ssh_config does not fix the problem.

My quick fix is to have additional URL’s forward to the same servers (dyndns is free). Then use one set of URL’s for sshfs, and the other for connecting to ssh with -Y -C. The computer thinks they are separate servers due to different names and so the connections are not shared.