diff --git a/config.cfg.sample b/config.cfg.sample index b1f5d85..91f2369 100644 --- a/config.cfg.sample +++ b/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 diff --git a/mnt-sftp.sh b/mnt-sftp.sh index e69a8bf..c2514c8 100755 --- a/mnt-sftp.sh +++ b/mnt-sftp.sh @@ -1,6 +1,6 @@ #!/bin/bash ######################################################################## -# Copyright (C) 2015 Max Mehl +# Copyright (C) 2018 Max Mehl ######################################################################## # # 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 {