All of lore.kernel.org
 help / color / mirror / Atom feed
* sshfs and autofs
@ 2009-12-18  4:08 Marc Weber
  2009-12-18 22:01 ` Marc Weber
  0 siblings, 1 reply; 15+ messages in thread
From: Marc Weber @ 2009-12-18  4:08 UTC (permalink / raw)
  To: autofs

If you google for sshfs and autofs you'll find many howtos telling you
to create a private key without passwords because this works.
Most of of those Howtos tell you as well that you should not be doing
this for security reasons..

I've found another solution:
It tries connecting to each running ssh-agent. The first being able to
connect to the ssh location will be used. This way you can keep using
passwords and still use autofs.

  #!/bin/sh -e
  # PATH must contains openssh, sed, sshfs lsof and pgrep
  pids=`pgrep ssh-agent`
  if [ -z "$pids" ]; then
    # no ssh-agent found. Maybe there is a key without password ? You should not be using this!
    sshfs -o ssh_command="ssh -o NumberOfPasswordPrompts=0" "$@"
  else
  for p in $pids; do
    export SSH_AGENT_PID=$p
    export SSH_AUTH_SOCK=$(lsof -p $p -a -U  -Fn | sed -n 's/^n//p')
    echo "trying to connect using ssh-agent $p $SSH_AUTH_SOCK" 1>&2
      sshfs -o ssh_command="ssh -o NumberOfPasswordPrompts=0" "$@" && exit 0 || true
  done
  exit 1
  fi

Of course it is just a dirty script. However it does a much better job
than using no password.

Do you host such examples somewhere as well?

Marc Weber

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2009-12-24 23:52 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-18  4:08 sshfs and autofs Marc Weber
2009-12-18 22:01 ` Marc Weber
2009-12-20 15:54   ` Stef Bon
2009-12-21 10:32     ` Marc Weber
2009-12-22 19:08       ` Stef Bon
2009-12-22 21:45         ` Marc Weber
2009-12-23 21:47           ` Stef Bon
2009-12-23 21:59             ` Stef Bon
2009-12-23 22:16               ` Marc Weber
2009-12-23 22:31                 ` Stef Bon
2009-12-23 22:53                   ` Marc Weber
2009-12-24 14:12                     ` Stef Bon
2009-12-24 23:52                       ` Marc Weber
2009-12-23 22:05             ` Marc Weber
2009-12-23 22:19               ` Stef Bon

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.