enable possibility to use SSH config file directory (OpenSSH >=7.3)
This commit is contained in:
@@ -2,8 +2,9 @@
|
|||||||
LOCALMOUNTDIR=/home/user/remote
|
LOCALMOUNTDIR=/home/user/remote
|
||||||
|
|
||||||
## mnt-sftp.sh
|
## mnt-sftp.sh
|
||||||
# Please insert predefined hosts in your SSH Config-file (default ~/.ssh/config). Please use keyfiles for passwordless authentication.
|
# Please insert predefined hosts in your SSH Config-file (default ~/.ssh/config). Please use keyfiles for passwordless authentication.
|
||||||
SSHCONFIG=$HOME/.ssh/config
|
# 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.
|
# 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
|
# Format: user;host;port;pass;path;localpath
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/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
|
# 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]}
|
PRESSHLIST[$i]=${PREUSER[$i]}"@"${PREHOST[$i]}":"${PREPATH[$i]}
|
||||||
done
|
done
|
||||||
|
|
||||||
# Read all hosts from ~/.ssh/config
|
# Read all hosts from SSH config file or config directory
|
||||||
SSHLIST=$(grep -E "Host\s[[:alnum:]]" $SSHCONFIG | awk -F' ' '{ print $2 }')
|
SSHLIST=$(grep -rE "Host\s[[:alnum:]]" $SSHCONFIG | awk -F' ' '{ print $2 }')
|
||||||
|
|
||||||
# Choose preconfigured HOST to mount
|
# Choose preconfigured HOST to mount
|
||||||
function mount {
|
function mount {
|
||||||
|
|||||||
Reference in New Issue
Block a user