Skip to main content

ssh mount using passwords saved in .netrc

Project description

* sshmount-netrc
A small Python script that mounts ssh mount points using authentication from your .netrc (or alternatively .authinfo) file.

** Dependencies
You will need the =sshfs= package installed and in the =PATH=.

On Arch linux it is located in the Community repo. You can install it using:
#+begin_src bash
pacman -S sshfs
#+end_src


** Installation
#+begin_src bash
python setup.py install
#+end_src

** Usage
*** netrc configuration
Your netrc file should have a line matching the following pattern:

#+BEGIN_EXAMPLE
machine my_server_name login my_login password my_password
#+END_EXAMPLE




*** command
Its simplest form:
#+begin_src bash
sshmount-netrc my_server_name
#+end_src

Specifying a custom mount point:
#+begin_src bash
sshmount-netrc -m my_mount_point my_server_name
#+end_src

Specifying a custom netrc location:
#+begin_src bash
sshmount-netrc -f ~/.authinfo my_server_name
#+end_src


*** default mount point
If no mount_point is specified the following default will be used
#+begin_src bash
~/mnt/my_login@my_server_name
#+end_src

*** result
Under the hood, this script will then execute the following linux commad:
#+begin_src bash
echo my_password | sshfs -o password_stdin my_login@my_server_name: /my_mount_point
#+end_src

** Limitation
Currently you cannot have multiple logins on one machine. This is due to a long standing shortcoming in the Python netrc library.
At the time of writing the bug describing it has not been resolved: http://bugs.python.org/issue11416

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sshmount-netrc-0.1.3.tar.gz (3.0 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page