mirror of
https://github.com/elitak/nixos-infect.git
synced 2024-12-22 16:18:29 +03:00
Add a search path /home/$SUDO_USER/ for ssh keys (#79)
This commit is contained in:
parent
d4b99a21bf
commit
1e2ab19808
1 changed files with 1 additions and 1 deletions
|
@ -11,7 +11,7 @@ makeConf() {
|
||||||
mkdir -p /etc/nixos
|
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
|
# 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'
|
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" ]] \
|
[[ -r "$trypath" ]] \
|
||||||
&& keys=$(sed -E 's/^.*((ssh|ecdsa)-[^[:space:]]+)[[:space:]]+([^[:space:]]+)([[:space:]]*.*)$/\1 \3\4/' "$trypath") \
|
&& keys=$(sed -E 's/^.*((ssh|ecdsa)-[^[:space:]]+)[[:space:]]+([^[:space:]]+)([[:space:]]*.*)$/\1 \3\4/' "$trypath") \
|
||||||
&& break
|
&& break
|
||||||
|
|
Loading…
Reference in a new issue