You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

145 lines
4.2 KiB

<style type="text/css">
p {
pre {
margin-left: 2em;
margin-right: 2em;
background-color: #ddd; padding: 10px;
color: green;
<h2>Mounting SDF Folders on a NetBSD Local Machine via mount_psshfs(8)</h2>
<h3>What is mount_psshfs(8) ?</h3>
<p><a href="">NetBSD</a> has its own implementation of
<a href="">FUSE</a> called ReFUSE(3); mount_psshfs(8) creates sshfs mounts via
PUFFS(4) (Pass-to-Userspace Framework File System). See the respective
manpages and References section for details.</p>
<h3>Creating basic psshfs mounts:</h3>
<p>You'll likely need root permissions to run mount_psshfs(8); examples
below assume the sudo(8) tool is installed.</p>
<p><b>ex.1)</b> create a basic read-only mount of an SDF user's $HOME directory under /mnt:</p>
sudo mount_psshfs -o ro /mnt's password: ********
<p>Use the mount(8) command to see what the mount looks like:</p>
mount -t puffs\|psshfs on /mnt type puffs|psshfs (read-only)
<p><b>ex.2)</b> mount read-write with compression
and public key authentication:</p>
sudo mount_psshfs -O Compression=yes -O IdentityFile=/home/local_user/.ssh/id_rsa /mnt
<p>For help setting up public key authentication see the <a
<p><b>ex.3)</b> put the above in /etc/fstab; mount to local /puffsmnt:</p>
sudo mkdir /puffsmnt
sudoedit /etc/fstab
# psshfs PUFFS mount of gopher dir on /puffsmnt psshfs rw,noauto,-O=BatchMode=yes,-O=IdentityFile=$HOME/.ssh/id_rsa,-t=-1
sudo mount /puffsmnt
<h3>Fixing the displayed file permissions with <b>mount_umap(8)</b></h3>
<p>With the above examples you'll probably notice that the UID:GID values
for the psshfs mount are either numerical values or otherwise not what
you might expect; this is because your local system doesn't have mappings
for the remote UID:GID (what you're seeing) to the local system. If you
like, you can create a local <i>sub-tree</i> of the puffs mount with
re-mapped UID:GID values using mount_umap(8). The following example
creates two mapfiles (must be root owned) and a new mount point under the
local user's $HOME directory and mounts /puffsmnt from ex.4 above:
<p><b>ex.5)</b> mount /puffsmnt to ~local_user/puffy with local_user:users permissions:</p>
<p>First, we find who's who on local system (note: UID/GID are fields 3 & 4):</p>
ls -dnl /puffsmnt
drwxr-xr-x 42 012345 550 512 Aug 31 2011 puffsmnt
grep local_user /etc/passwd
local_user:*:1000:100:Loco User ,Seattle,WA ,:/home/local_user:/bin/ksh
<p>From above we see that we need to re-map local UID 1000 to 012345,
and local GID 100 to 550. We just have one remapping each so the
uid-mapfile and gid-mapfile files get made like so:</p>
sudoedit /uid-mapfile
1000 012345
sudoedit /gid-mapfile
100 550
<p>Now we make the ~local_user/puffy dir and mount the umap sub-tree of /puffsmnt on it:</p>
mkdir ~local_user/puffy
sudo mount_umap -o nocoredump -g /gid-mapfile -u /uid-mapfile /puffsmnt ~local_user/puffy
<p>Use mount(8) and ls(1) to see what the umap mount looks like:</p>
mount -t umap
/puffsmnt on /home/local_user/puffy type umap (nocoredump)
ls -dl ~local_user/puffy
drwxr-xr-x 101 local_user users 512 Dec 6 2010 puffy
<p>Alternately, you can add the umap mount to /etc/fstab:</p>
sudoedit /etc/fstab
/puffsmnt /home/local_user/puffy umap rw,noauto,nocoredump,-g=/gid-mapfile,-u=/uid-mapfile
sudo mount ~local_user/puffy
<h3>Unmounting umap and psshfs mounts:</h3>
<p>Unmount umap and psshfs mounts in the usual way with umount(8), but do it in <em>reverse</em> order:</p>
sudo umount ~local_user/puffy
sudo umount /puffsmnt
<li><a href="">NetBSD PUFFS documentation</a>
<li><a href="">NetBSD manpages</a>
<cite>$Id: psshfs.html,v 1.2 2011/12/13 05:53:48 jgw Exp $</cite>