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

This commit is contained in:
2018-04-17 11:42:03 +02:00
parent a9163cfe04
commit 4f3e2d14ee
2 changed files with 6 additions and 5 deletions

View File

@@ -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

View File

@@ -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 {