From 1e2ab19808038b9598f88b69a6c1d3e1ce4c92dd Mon Sep 17 00:00:00 2001 From: asdfasdf <67588957+asdf8dfafjk@users.noreply.github.com> Date: Sat, 31 Jul 2021 23:02:35 +0530 Subject: [PATCH] Add a search path /home/$SUDO_USER/ for ssh keys (#79) --- nixos-infect | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos-infect b/nixos-infect index 95cca1a..da0bcc7 100755 --- a/nixos-infect +++ b/nixos-infect @@ -11,7 +11,7 @@ makeConf() { mkdir -p /etc/nixos # Prevent grep for sending error code 1 (and halting execution) when no lines are selected : https://www.unix.com/man-page/posix/1P/grep local IFS=$'\n' - for trypath in /root/.ssh/authorized_keys $HOME/.ssh/authorized_keys; do + for trypath in /root/.ssh/authorized_keys /home/$SUDO_USER/.ssh/authorized_keys $HOME/.ssh/authorized_keys; do [[ -r "$trypath" ]] \ && keys=$(sed -E 's/^.*((ssh|ecdsa)-[^[:space:]]+)[[:space:]]+([^[:space:]]+)([[:space:]]*.*)$/\1 \3\4/' "$trypath") \ && break