From 287427af94d4741721fdce738fb2296a326bb7b8 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Fri, 26 Jun 2020 07:37:24 +0000 Subject: [PATCH] ensure .ssh/config and .ssh/authorized_keys --- ssh-utils/ssh-adduser.sh | 2 ++ ssh-utils/ssh-pubkey.sh | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/ssh-utils/ssh-adduser.sh b/ssh-utils/ssh-adduser.sh index e6c7112..621e314 100644 --- a/ssh-utils/ssh-adduser.sh +++ b/ssh-utils/ssh-adduser.sh @@ -31,6 +31,8 @@ chmod 0700 /home/me/.ssh/ cp -r "$HOME/.ssh/authorized_keys" /home/me/.ssh/ chmod 0600 /home/me/.ssh/authorized_keys + touch /home/me/.ssh/config + chmod 0644 /home/me/.ssh/config chown -R me:me /home/me/.ssh/ # ensure that 'me' has an SSH Keypair diff --git a/ssh-utils/ssh-pubkey.sh b/ssh-utils/ssh-pubkey.sh index 074a098..588dcca 100644 --- a/ssh-utils/ssh-pubkey.sh +++ b/ssh-utils/ssh-pubkey.sh @@ -9,6 +9,17 @@ chmod 0700 "$HOME/.ssh/" fi + if [ ! -f "$HOME/.ssh/config" ]; then + # for the benefit of VSCode + touch "$HOME/.ssh/config" + chmod 0644 "$HOME/.ssh/config" + fi + + if [ ! -f "$HOME/.ssh/authorized_keys" ]; then + touch "$HOME/.ssh/authorized_keys" + chmod 0600 "$HOME/.ssh/authorized_keys" + fi + if [ ! -f "$HOME/.ssh/id_rsa" ]; then ssh-keygen -b 2048 -t rsa -f "$HOME/.ssh/id_rsa" -q -N "" echo "" -- 2.25.1