From 9e37c6b5221d29da5623ff898204027ac1fd2005 Mon Sep 17 00:00:00 2001 From: Franscobec Date: Sat, 31 Jan 2026 22:03:42 -0500 Subject: [PATCH] Fix known_hosts rm to detect if file is present first --- renewkeys.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/renewkeys.sh b/renewkeys.sh index 4a9e8a8..eb881cb 100644 --- a/renewkeys.sh +++ b/renewkeys.sh @@ -179,8 +179,12 @@ if [ "$UID" -ne 0 ]; then fi echo -e ${CY}Warning: running this script resets known_hosts file. Abort this script using CTRL+C if you want to avoid that.${NF} sleep 3 +if [ -f /home/$USER/.ssh/known_hosts ]; then rm /home/$USER/.ssh/known_hosts +fi +if [ -f /root/.ssh/known_hosts ]; then rm /root/.ssh/known_hosts +fi if [ ! -f ".SSH/.temp" ]; then mkdir /.SSH/.temp fi