Skip to content

Instantly share code, notes, and snippets.

@sirolf2009
Last active October 4, 2019 11:45
Show Gist options
  • Save sirolf2009/a7170d0a8a5283f3472a5a2515731b5f to your computer and use it in GitHub Desktop.
Save sirolf2009/a7170d0a8a5283f3472a5a2515731b5f to your computer and use it in GitHub Desktop.
a script to test and debug why your public key doesn't work. Run on remote. wget -q -O - https://gist.githubusercontent.com/sirolf2009/a7170d0a8a5283f3472a5a2515731b5f/raw/00e13f486057a2dbe592a8d7293e42ca0f64c9d9/fix-ssh-keys | bash
#!/bin/bash
echo "Fixing permissions"
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
FLAVOR=$(cat /etc/*release | grep "^NAME=" | cut -d \" -f2)
if [ "$FLAVOR" == "CentOS Linux" ]; then
echo "CentOS detected, fixing ACL on ~/.ssh"
sudo restorecon -R -v ~/.ssh
fi
echo "Starting debug SSH server on port 2222"
sudo /usr/sbin/sshd -d -p 2222
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment