Last active
October 4, 2019 11:45
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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