Browse Source

enable possibility to use SSH config file directory (OpenSSH >=7.3)

master
max.mehl 4 years ago
parent
commit
4f3e2d14ee
Signed by: mxmehl GPG Key ID: 2704E4AB371E2E92
  1. 5
      config.cfg.sample
  2. 6
      mnt-sftp.sh

5
config.cfg.sample

@ -2,8 +2,9 @@
LOCALMOUNTDIR=/home/user/remote
## mnt-sftp.sh
# Please insert predefined hosts in your SSH Config-file (default ~/.ssh/config). Please use keyfiles for passwordless authentication.
SSHCONFIG=$HOME/.ssh/config
# Please insert predefined hosts in your SSH Config-file (default ~/.ssh/config). Please use keyfiles for passwordless authentication.
# You can also use directories, e.g. '~/.ssh/config.d/*'
SSHCONFIG=~/.ssh/config
# If you don't want to use your .ssh/config file or need to define the passwords manually, you can add predefined entries here.
# Format: user;host;port;pass;path;localpath

6
mnt-sftp.sh

@ -1,6 +1,6 @@
#!/bin/bash
########################################################################
# Copyright (C) 2015 Max Mehl <mail@mehl.mx>
# Copyright (C) 2018 Max Mehl <mail@mehl.mx>
########################################################################
#
# This program is free software: you can redistribute it and/or modify
@ -51,8 +51,8 @@ do
PRESSHLIST[$i]=${PREUSER[$i]}"@"${PREHOST[$i]}":"${PREPATH[$i]}
done
# Read all hosts from ~/.ssh/config
SSHLIST=$(grep -E "Host\s[[:alnum:]]" $SSHCONFIG | awk -F' ' '{ print $2 }')
# Read all hosts from SSH config file or config directory
SSHLIST=$(grep -rE "Host\s[[:alnum:]]" $SSHCONFIG | awk -F' ' '{ print $2 }')
# Choose preconfigured HOST to mount
function mount {

Loading…
Cancel
Save