Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p><a href="http://www.tjansson.dk/?p=84" rel="nofollow">Thomas Jansson provides a guide on integrating <code>sshfs</code> with <code>autofs</code></a>. I'll summarize his guide here, so this answer will still be worth something if his site ever goes offline:</p> <p>Create an <code>/etc/auto.master</code>:</p> <pre><code>/mnt/sshfs /etc/auto.sshfs uid=1000,gid=1000,--timeout=30,--ghost </code></pre> <p>Make sure your <code>uid</code> and <code>gid</code> match your userid and guid in <code>/etc/passwd</code> or whatever you use to provide system accounts.</p> <p>Now add lines into <code>/etc/auto.sshfs</code>, one per desired filesystem, in the following form:</p> <pre><code>bar -fstype=fuse,rw,nodev,nonempty,noatime,allow_other,max_read=65536 :sshfs\#tjansson@bar.com\: </code></pre> <p>Be sure to change <code>tjansson@bar.com</code> to whatever user account and hostname you're going to be using. Change the leading <code>bar</code> to whatever you'd like the directory to be named. When you <code>cd /mnt/sshfs/bar</code>, <code>autofs</code> will automatically mount the FUSE filesystem for you. Of course, using SSH keys and the <code>ssh-agent(1)</code> will make this far more pleasant.</p> <p><strong>Update</strong></p> <blockquote> <p>... create a directory that literally logs you into the other machine.</p> </blockquote> <p>Hey, that's pretty clever idea. You could either write a <a href="http://www.talug.org/events/20030813/cmdline_tips_n_tricks_aug03.html" rel="nofollow">shell function</a> that checks the directory name you want to <code>cd</code> into and start a new <code>ssh</code> for you. Maybe you can (ab)use the <a href="http://tldp.org/HOWTO/Bash-Prompt-HOWTO/x264.html" rel="nofollow"><code>PROMPT_COMMAND</code></a> variable to <code>ssh</code> to the host if the directory name matches. Be warned that either approach <em>will</em> slow down your normal <code>cd</code> <em>or</em> every prompt display.</p> <p>Another approach that I've used and enjoyed is a small little helper script, <code>~/bin/ssh-to</code>:</p> <pre><code>#!/bin/bash hostname=`basename $0` ssh $hostname $* </code></pre> <p>Symlink new names to this shell script: <code>ln -s ssh-to sarnold.org</code> and then you can run a command or log in on a remote site without typing the <code>ssh</code> all the time:</p> <pre><code>sarnold.org python foo.py </code></pre> <p>It'll log you in to whatever machine you've used for the name of the symbolic link and run whatever command you give it.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload