Page tree

Welcome to FreeSoftwareServers Confluence Wiki

Skip to end of metadata
Go to start of metadata

Add SSH Host Key to Known_Hosts

REPLACE USERNAME

Starting with roots known_hosts

sudo mv /root/.ssh/known_host* /tmp/
cat << 'EOL' >/root/.ssh/known_hosts
${KNOWN_HOSTS}
EOL
sudo chmod 600 /root/.ssh/*
sudo chmod 400 /root/.ssh/id_rsa 2>/dev/null
sudo chown root:root /root/.ssh/ -R
sudo cp /root/.ssh/known_hosts /home/[USERNAME]/.ssh/known_hosts 2>/dev/null
sudo chmod 600 /home/[USERNAME]/.ssh/* 2>/dev/null
sudo chmod 400 /home/[USERNAME]/.ssh/id_rsa 2>/dev/null
sudo chown [USERNAME]:[USERNAME] /home/[USERNAME]/.ssh/ -R 2>/dev/null
  • No labels