Merge pull request #1493 from bingzhangdai/patch-1

Create ~/.ssh and ~/.ssh/config if does not exits
pull/1496/head
Nils Winkler 2020-02-16 12:33:04 +01:00 committed by GitHub
commit fb7160cf60
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -8,6 +8,9 @@ function add_ssh() {
param '3: user'
group 'ssh'
[[ $# -ne 3 ]] && echo "add_ssh host hostname user" && return 1
[[ ! -d ~/.ssh ]] && mkdir -m 700 ~/.ssh
[[ ! -e ~/.ssh/config ]] && touch ~/.ssh/config && chmod 600 ~/.ssh/config
echo -en "\n\nHost $1\n HostName $2\n User $3\n ServerAliveInterval 30\n ServerAliveCountMax 120" >> ~/.ssh/config
}