Fix known_hosts rm to detect if file is present first

This commit is contained in:
2026-01-31 22:03:42 -05:00
parent caaf96cedb
commit 9e37c6b522

View File

@@ -179,8 +179,12 @@ if [ "$UID" -ne 0 ]; then
fi 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} 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 sleep 3
if [ -f /home/$USER/.ssh/known_hosts ]; then
rm /home/$USER/.ssh/known_hosts rm /home/$USER/.ssh/known_hosts
fi
if [ -f /root/.ssh/known_hosts ]; then
rm /root/.ssh/known_hosts rm /root/.ssh/known_hosts
fi
if [ ! -f ".SSH/.temp" ]; then if [ ! -f ".SSH/.temp" ]; then
mkdir /.SSH/.temp mkdir /.SSH/.temp
fi fi